Read text by line number

0
Hello,   I have a string variable with multiple lines. How can I read a particular line from this string. Like, get 4th line from the string variable.   Thank you
asked
1 answers
0

You could use the String Split action from the Community Commons module in the Marketplace.

https://docs.mendix.com/appstore/modules/community-commons-function-library/#stringutils

 

You can pass your String variable to the String Split action, along with the splitParameter pattern you want to split the string with. In your case, the pattern will be a newline. This will return a list of SplitItem objects with a String and the Index of each match. You can then look in this list to find the matching line based on the Index attribute.

 

I hope this helps. Good luck!

answered