How can i replace text with line break

How can i replace the string "{TAG}" to "SOME_TEXT line break"

Thank you

5 Replies 1 reply marked as answer

HC Harini Chellappa Syncfusion Team November 16, 2020 07:37 AM UTC

Hi S_Line, 
 
Syncfusion Greetings! 
 
Can you please explain your usecase scenario on this in detail? So that we will check accordingly and provide you the solution at the earliest. 
 
Regards, 
 
Harini C 



S_ S_Line November 16, 2020 10:58 AM UTC

Yes.

I want to replace the string text "{XYZ}" by some string that have a line break, like 

"
string replaced 1
string replaced 2
string replaced 3
"

how can i do this?


SR Stephen Raj Chandra Sekar Syncfusion Team November 17, 2020 01:35 PM UTC

Hi S_Line, 
 
You can achieve this use case by using findAll API to find all occurrences of the text “{XYZ}” in document Editor. Then use “replaceAll” to replace all the occurrences of the searched text in the document editor. Also, you can refer below documentation for customize find & replace. 
 
 
And you can use “\v” for linebreak. Also use below code snippet to pass it in “replaceAll” API achieve your use case. 
 
sring toReplace = 'string1' + '\v' + 'string2' + '\v' + 'string3'; 
 
Regards, 
Stephen Raj

Marked as answer

S_ S_Line November 17, 2020 05:33 PM UTC

Thank you very much, works fine!


HC Harini Chellappa Syncfusion Team November 18, 2020 11:47 AM UTC

Hi S_Line, 
 
Welcome! 
 
Regards, 
 
Harini C 


Loader.
Up arrow icon