Hi we need a formatted string for our application.
Expected output :
Blow the candles real hard,
Coz now you have aged,
Don't pretend so much my dear,
Don't behave so sage,
Happy birthday to you,
Have a nice day,
Make the most of your day!
I want to format a string as shown above, when I use trim() function for string it gives the result as
Blow the candles real hard,
Coz now you have aged,
Don't pretend so much my dear,
Don't behave so sage,
Happy birthday to you,
Have a nice day,
Make the most of your day!
I want to remove the white spaces at the start of each line. I have used these functions below, it trimmed the start and end of the string but not lines.
poemText = poemText.trimMargin()
poemText = poemText.trimIndent()
poemText = poemText.replace("\n ", "\n")
for(line in poemText.lines())
{line.trim()}
Any help is appreciated