I just want to split a string using spitstring or regex i will get the string input from email .i offten get error while splitting that can anyone help me

Installer(.exe or .msi):

License type(Free, Trial/License code):

Studio/Robot version:

Current behavior:

Hello @Karthikeyan34

I suggest removing your Xaml file because there is some sensitive data in it.

After that, please tell us what string you want to split, I would gladly help you with that

yes sure @srdjan.suc


This is my input from mail.
I used split string method as
outtext=str.(Environment.newline.toarray())
And used for each and passed the argument as string


I tried that converting that in lot of methods
errors: onedimensional array cant be converted to string
system.char cant be system.string
index exception

Try this :

Because you are looping a string, and that returns a char. Change the TypeArgument to Char, instead of String.

yes i tried that …there is a error : index was outside the bond of a array

@Karthikeyan34 if don’t mind can you share you str variable

str variable is from mail and the mail will be
string- input
The below users are
Quy-devqnx
Abc-yhj
Emp-get

OUPUT needed is
The below users are
Quy-devqnx
Abc-yhj
Emp-get

Output needed
User 1-Quy
Id1-devqnx

User2-Abc
Id2-yhj

User3-Emp
Id3-get

And the programm is
–if this text is saved in a string variable like this
intext = “Quy-devqnx
Abc-yhj
Emp-get”
–then use a assign activity and mention like this
outtext = intext.Split(Environment.Newline.ToArray())
where outtext is a variable of type string array
–now use a for each loop and pass the above variable as input and change the type argument as string in the property panel
–inside the loop simply use a assign activity like this
out_user = Split(item,"-")(1).ToString.Trim //output is Quy
another assign activity with
out_user = Split(item,"-")(0).ToString.Trim //output is devqnx

And the posibble errors are
system.chat cant be system.string
one dimensional array cant be system.string
object is outside the bond of the index
for each : the cast is invalid

can you help me with this @venkatmalla6

Hi @Karthikeyan34

Are you using it in string array

Try this String.split("".ToCharArray)

Thanks
Ashwin.S

@AshwinS2 yes i tried but there is a error index was outside the bond of the array

Use this query within assign strarray=strvar.split("-".ToCharArray)

Use for each item in strarray

Print the values

Thanks
Ashwin.S

@Karthikeyan34 give this entire expression in assign activity and store it in a variablesplit(strarray.Split(environment.NewLine.ToArray(),stringsplitoptions.RemoveEmptyEntries)(0),"-")(0).ToString here first 0 indicates first line, 0 indicates index value of quy
similarly use value in place of 0,0 as follows to get the value
0,1
1,0
1,1
2,0
2,1
store the respective values as per your requirement