New Line


I am getting an output (text array) like


i want to store ABC DEF in a variable called FirstName and
LMN in LastName. May be using new line or something. I need a sample coding if possible.

Note : ABC DEF
present in Text Array

try with this buddy
intext = “ABC DEF
where intext is of text with two line in ti

Firsname = intext.split(Environment.Newline.ToArray())(0).ToString
Lastname = intext.split(Environment.Newline.ToArray())(1).ToString

or if intext is a text array and this value “ABC DEF
LMN” is present in first index of the array
then like this buddy
Firsname = intext(0).split(Environment.Newline.ToArray())(0).ToString
Lastname = intext(0).split(Environment.Newline.ToArray())(1).ToString

Check this article

Hi @Robotics,

As you have mentioned that the data is present in a text array, First try to form a single string from that array using String.Join and then split using the delimiter present in the string.

Or else if the length of the array is fixed then use direct assignments like bleow
First name = array(0)+array(1)

Shiva Karthik


Please use below code if that matches your requirement,

strArr = {“ABC”, “DEF”, “LMN”}
firstEle = strArr(0).ToString // ABC
secondEle = strArr(1).ToString // DEF
Above two variables will make a firstname by concatenating them
firstName = firstEle + secondEle // ABCDEF

for last name
lastName = strArr(2).ToString // LMN


Below is the code i am using

Output what i am getting is
First Name : ABC DEF
Last Name :

Is ABC DEF and LMN are of two lines in that array
Buddy @Robotics

Yes if i print like TextArray(1) it shows the output as below

two lines only. first line we are able to get but second line is blank.

i think we are missing something
can i have a view one the array you have and xaml if possible buddy
We can resolve this easily…
Cheers @Robotics

Hi Palaniyappa, got the result modified as below changed as (0))(1).ToString.

Thanks for your timely help buddy.

Lastname = TextArray(1).split(Environment.Newline.ToArray(0))(1).ToString

1 Like

I was about to mention a suggestion of same like we can mention the index as argument in ToArray(0), as well
Cheers @Robotics