Reputation: 41
If I have the following string: table.row.columns.values.many
. I am looking to add character *
after values
.
So expected output would be: table.row.columns.values*.many
.
If there is no "values"
in string then string should stay the same.
Upvotes: 0
Views: 453
Reputation: 1734
I think this works nice for you, really simple, and easy way
var str = "table.row.columns.values.many";
str = str.replace("values", "values*")
console.log(str)
Upvotes: 0
Reputation: 1278
Please use this code.
let str = "table.row.columns.values.many"
str = str.replace("values", "values*");
console.log(str);
You can use also "replaceAll" if you want to replace all "values".
Upvotes: 1