Hi,
I have a string with list of names extracted from get text, now how can i convert into array list separated by “,” so that i can use these list in loop.
Ex:
Mahesh
Ramesh
Suresh
Result: {Mahesh,Ramesh,Suresh}
Thanks
Hi,
I have a string with list of names extracted from get text, now how can i convert into array list separated by “,” so that i can use these list in loop.
Ex:
Mahesh
Ramesh
Suresh
Result: {Mahesh,Ramesh,Suresh}
Thanks
Hi @balu,
Use environment.newline split the string.
Try below code
arrvalue=strValue.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries)
Regards,
Arivu
getting result as system.string.
Yes array of string,
So u don’t want array of String u just want the format like string only??
i have created a array variable with system.string
input:
red
white
yellow
expected Output:
{red,white,yellow}
but its giving output as system.string
Hi @balu,
strValue=strValue.Replace(Environment.NewLine,",")
Yes split option will return the array of String value only.
Regards,
Arivu
Hi arivu,
Let say i have StrVaribale with list of names
red
yellow
white
can i read each row from variable to loop in further.
Hi @balu,
Use this code to get the value. And use for each to loop through the value.
Regards,
Arivu
this is the output “system.string” after using above code think its not getting the values.
out put is not accurate.
Hi,
i think the issue here is that you are trying to view the output the wrong way as it is a collection. arrvalue.ToString will show as System.String. If you loop through arrvalue and check each item it should show correct output. Or you can just check for example arrvalue.First, which will give the first item in your array.
br,
Topi
yes bro correct. i tried to view array value so gave system.string value when i use it in loop i got exact values. thanks @arivu96 & @Topi.
Hi its not removing empty strings.?
How to remove empty values from these array ??
Hi Balu,
Sometimes logical thinking gives the solution for technical issues.
User Replace String Activity to remove the spaces in String and Array of string below image may give the solution for your issue.
HI @balu,
For example myColors is your array try below code.
List<string> tempListColors = new List<string>();
foreach (string color in myColors)
{
if (!string.IsNullOrEmpty(color))
tempListColors.Add(color);
}
myColors = tempListColors.ToArray();
Regards,
Arivu