(str = "", options?: { inplace?: boolean })
| 360 | */ |
| 361 | indexOf(str: string, options?: { inplace?: boolean }): Series |
| 362 | indexOf(str = "", options?: { inplace?: boolean }): Series | void { |
| 363 | const { inplace } = { inplace: false, ...options } |
| 364 | const newArr: Array<number> = []; |
| 365 | this.values.map((val) => { |
| 366 | if (utils.isEmpty(val)) { |
| 367 | newArr.push(NaN); |
| 368 | } else { |
| 369 | newArr.push(`${val}`.indexOf(str)); |
| 370 | } |
| 371 | }); |
| 372 | if (inplace) { |
| 373 | this.series.$setValues(newArr as ArrayType1D) |
| 374 | this.series.print() |
| 375 | } else { |
| 376 | const sf = this.series.copy() |
| 377 | sf.$setValues(newArr as ArrayType1D) |
| 378 | return sf; |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | /** |
| 383 | * Returns the position of the last found occurrence of a specified value in a string |
no test coverage detected