Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
vincecassel
Contributor III
Contributor III

Split a string with a Carriage Return in the middle

Hello to everybody,

 

I have a problem and I don't know if I can resolve it.

I have a field (from an Hive table) that have a Carriage Return in his middle (it is a field called AddressComplete and it has the street and the city), I want to take the street when the city is like "London".

Does anybody know how can I do?

The row separator is "\n" and the field separator is "\t"

Labels (3)
1 Solution

Accepted Solutions
vincecassel
Contributor III
Contributor III
Author

I resolved using this function:
(AddressComplete.split("\r\n").length > 1 ?
(AddressComplete.split("\r\n")[1]):Address)

View solution in original post

2 Replies
Anonymous
Not applicable

You need use row1.Addresscomplete.replaceAll("\\n", "|"). You can then use "|" character to split the string 

vincecassel
Contributor III
Contributor III
Author

I resolved using this function:
(AddressComplete.split("\r\n").length > 1 ?
(AddressComplete.split("\r\n")[1]):Address)