How to split a variable value with respect to each each line?


#1

I have to separate out each line of address to different indexes of an array.

Eg: 123/68A
KK Street
Karnataka

This address should be split with respect to each line and save to an array.


#2

@certified


#3

Try this into an ‘Assign’: arrayVar = yourText.Split(Environment.NewLine.ToArray)


#4

An extra empty line is generated between two lines.

Below is the array created. Why is this getting created like this.

[1]:
[2]: KK Street
[3]:
[4]: Karnataka


#5

Try: yourText.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries). Hope it works!


#6

This worked. Thanks