Parse Text String - Line Breaks

Certified Associate Developer

I need to parse a text string that has the following format:

"firstName

firstName lastName

companyName

context"

Is there a function that can identify where a linebreak is in Appian? Or a way for me to return text from a specific line in a text string? 

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    What is your end goal in particular?  In such cases I've sometimes found it useful to use the "split" function and split on linebreaks, which will result in an array of items each of which being the text entries in between linebreaks (which would include blank lines, you'd need to deal with separately).

    i.e. split( ri!incomingText, char(10) )

    Also be aware that depending on the source of the incoming text, sometimes a linebreak will be a single "char(10)", and sometimes each linebreak will be represented by both char(10) and char(13) (i.e. \r and \n).  Text entered directly into Appian won't use char(13), but text from external sources might have it.  You might need to take this into account when implementing your solution depending on your use case and the source of your incoming text.

Reply
  • +1
    Certified Lead Developer

    What is your end goal in particular?  In such cases I've sometimes found it useful to use the "split" function and split on linebreaks, which will result in an array of items each of which being the text entries in between linebreaks (which would include blank lines, you'd need to deal with separately).

    i.e. split( ri!incomingText, char(10) )

    Also be aware that depending on the source of the incoming text, sometimes a linebreak will be a single "char(10)", and sometimes each linebreak will be represented by both char(10) and char(13) (i.e. \r and \n).  Text entered directly into Appian won't use char(13), but text from external sources might have it.  You might need to take this into account when implementing your solution depending on your use case and the source of your incoming text.

Children
No Data