const Str = 'Your name +++Vijay+++Welcome to hello world '
I want to replace Vijay with reactJS content editable, where i can change the name.
you can use string template to do that try
const changeStr = (name = "USER_NAME") => `Your name ${name} Welcome to hello world`
then
changeStr('Vijay')
I think you can use the replace function https://www.w3schools.com/jsref/jsref_replace.asp
let Str = 'Your name +++Vijay+++Welcome to hello world '
Str = Str.replace("Vijay", "something you want")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.