(startIndex = 0, num = 1, options?: { inplace?: boolean })
| 606 | */ |
| 607 | substr(startIndex: number, num: number, options?: { inplace?: boolean }): Series |
| 608 | substr(startIndex = 0, num = 1, options?: { inplace?: boolean }): Series | void { |
| 609 | const { inplace } = { inplace: false, ...options } |
| 610 | const newArr: Array<string | number> = []; |
| 611 | this.values.map((val) => { |
| 612 | if (utils.isEmpty(val)) { |
| 613 | newArr.push(NaN); |
| 614 | } else { |
| 615 | newArr.push(`${String(val).substr(startIndex, num)}`); |
| 616 | } |
| 617 | }); |
| 618 | if (inplace) { |
| 619 | this.series.$setValues(newArr as ArrayType1D) |
| 620 | this.series.print() |
| 621 | } else { |
| 622 | const sf = this.series.copy() |
| 623 | sf.$setValues(newArr as ArrayType1D) |
| 624 | return sf; |
| 625 | } |
| 626 | } |
| 627 | |
| 628 | /** |
| 629 | * Extracts the characters from a string, between two specified indices |
no test coverage detected