How to convert UIPath.Core.GenericValue into a string array


#1

Hi

Can i know how to convert the Generic Value to a string array so that i can iterate through the content.
I have used copy selected text activity in which the default variable type it storing is GenericValue.
Is there any possible option to convert this variable type to string array.

Thanks


#2

image

just change variable type

You want to change dynamically while running the script ?


#3

Hi,

When i am changing the Variable Type in the Variables it showing compilation error.


#4

You have to use Assign activity and change GenericValue as string and assign to System.String[] variable.


#5

Hi @Bonagend ,
Copy selected text activity don’t support array type.
just create a new string variable from variable pane and pass to the output property of Copy selected text.(It doesn’t have to be generic type .it does accept string)

string


#6

Looks like you’re using copy selected text to copy data form notepad which is stored one below the other. If this format of input data is always going to be the same; use the Split method and use the newline character as the separator. this will return you every element as a separate string in a string array.
Hope this helps.
If you still don’t get how to go about this, let us know. someone or the other will surely help further.


#7

assign the texts to a string variable str .

then assign str.ToString.Split({" "},StringSplitOptions.None) to stringArray.

Now you got your array.