| 432 | */ |
| 433 | replace(searchValue: string, replaceValue: string, options?: { inplace?: boolean }): Series |
| 434 | replace(searchValue = "", replaceValue = "", options?: { inplace?: boolean }): Series | void { |
| 435 | const { inplace } = { inplace: false, ...options } |
| 436 | const newArr: Array<string | number> = []; |
| 437 | this.values.map((val) => { |
| 438 | if (utils.isEmpty(val)) { |
| 439 | newArr.push(NaN); |
| 440 | } else { |
| 441 | newArr.push(`${val}`.replace(searchValue, replaceValue)); |
| 442 | } |
| 443 | }); |
| 444 | if (inplace) { |
| 445 | this.series.$setValues(newArr as ArrayType1D) |
| 446 | this.series.print() |
| 447 | } else { |
| 448 | const sf = this.series.copy() |
| 449 | sf.$setValues(newArr as ArrayType1D) |
| 450 | return sf; |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | /** |
| 455 | * Returns a new string with a specified number of copies of an existing string |