word wrap after every comma in a text ?

Post your questions and help other users.

Moderator: Martin

Post Reply
joeko
Posts: 34
Joined: 17 Jan 2017 19:21

word wrap after every comma in a text ?

Post by joeko » 06 Jun 2019 14:07

hallo,
i have a text like

word word word, word word word, word word word,word word ……….

now i am Looking for a way to Format the text that after every comma a new line start like

word word word,
word word word,
word word word,

i believe i can use \\n but this doesnt work. can someone help ?
later this i want to Show this text as a message dialog

User avatar
yogi108
Posts: 100
Joined: 09 Nov 2016 08:00
Contact:

Re: word wrap after every comma in a text ?

Post by yogi108 » 06 Jun 2019 16:04

Hi,

You can use something like this:
search for ', ' (comma and space, if no space remove it)
replace with newline '\n'
txt=replaceAll('word word word, word word word, word word word', '(?sm)(, )', '\n');
Hope it helps,
Regards
"You cannot know the meaning of your life until you are connected to the power that created you.”
Shri Mataji Nirmala Devi, founder of Sahaja Yoga

joeko
Posts: 34
Joined: 17 Jan 2017 19:21

Re: word wrap after every comma in a text ?

Post by joeko » 06 Jun 2019 19:08

yes it helped :-)
thank you

User avatar
yogi108
Posts: 100
Joined: 09 Nov 2016 08:00
Contact:

Re: word wrap after every comma in a text ?

Post by yogi108 » 06 Jun 2019 20:36

Welcome :D
"You cannot know the meaning of your life until you are connected to the power that created you.”
Shri Mataji Nirmala Devi, founder of Sahaja Yoga

Post Reply