I am trying to convert a string into array of strings with space as delimiter

HI,

I would like to convert the string which has the format of “Last_Name First_name Mail_id” into in a array of string which needs to be written in 3 different columns in an excel sheet.

How can I do that, Kindly help

Regards,
Selva

HI @selvarani1390,

Can you give me the sample format?

if you want to convert array to string use below code

string.join(",",arrvalue)

Regards,
Arivu

Hi @selvarani1390

Try this:

"Last_Name First_name Mail_id".Split(" "C)

This will give you an array you want, to access each element you either loop through it or do it like that:

"Last_Name First_name Mail_id".Split(" "C)(0)

If I am not wrong, you can use this array directly in the Add Data Row activity as input :slight_smile:

Here is the sample string

Example : Horton Jeremy jeremy.horton@example.com

I want it like a[0] - Horton a[1] - Jeremy a[2] - jeremy.horton@example.com

and finally it has to write the array values in 3 different columns of an excel sheet.

Regards,
Selva

Check out this thread.

HI @selvarani1390,

strvalue="Horton Jeremy jeremy.horton@example.com"
arrvalue=strvalue.Split(" "c)

arrvalue[0]=Horton
arrvalue[1]=Jeremy
arrvalue[2]=jeremy.horton@example.com

Regards,
Arivu

Hi Arivu,

Thanks for your response.

But it is not giving me the correct output as expected , when I tried writing it in the output pane using write line activity by converting it into a string, I am getting the result as “System.String

Kindly help.

Regards,
Selva

You’re getting an array. If you print the array variable, that’s what you’ll end up getting in your output pane. As he mentioned, use index values: arrvalue(0)

arrvalue(0) shall give you “Horton”, arrvalue(1) shall give you “Jeremy” and so on.

Refer this xaml file.
Splitstring.xaml (9.6 KB)

Regards,
Arivu

Hi Arivu,

Thanks, it worked :slight_smile:

It meant lot to me.

Regards,
Selva

Hii guys,
Pls Help me to find out this issue,
i have pipe separated text file and i read that using “Files.ReadAlllines”,
After that i want to convert the pipe separated string comes from Text file into another Array,

How can i do that Please Help me ,

Regards,
Nutan