MCPcopy Index your code
hub / github.com/javascriptdata/danfojs / startsWith

Method startsWith

src/danfojs-base/core/strings.ts:257–275  ·  view source on GitHub ↗
(str = "", options?: { inplace?: boolean })

Source from the content-addressed store, hash-verified

255 */
256 startsWith(str: string, options?: { inplace?: boolean }): Series
257 startsWith(str = "", options?: { inplace?: boolean }): Series | void {
258 const { inplace } = { inplace: false, ...options }
259 const newArr: Array<boolean | number> = [];
260 this.values.forEach((val) => {
261 if (utils.isEmpty(val)) {
262 newArr.push(NaN);
263 } else {
264 newArr.push(`${val}`.startsWith(str));
265 }
266 });
267 if (inplace) {
268 this.series.$setValues(newArr as ArrayType1D)
269 this.series.print()
270 } else {
271 const sf = this.series.copy()
272 sf.$setValues(newArr as ArrayType1D)
273 return sf;
274 }
275 }
276
277 /**
278 * Checks whether a string ends with specified characters

Callers 11

strings.test.jsFile · 0.80
_locFunction · 0.80
$readJSONFunction · 0.80
$readExcelFunction · 0.80
$readJSONFunction · 0.80
$streamJSONFunction · 0.80
$readCSVFunction · 0.80
$streamCSVFunction · 0.80
$openCsvInputStreamFunction · 0.80
$readExcelFunction · 0.80
strings.test.tsFile · 0.80

Calls 4

isEmptyMethod · 0.80
$setValuesMethod · 0.80
printMethod · 0.65
copyMethod · 0.65

Tested by

no test coverage detected