How to Convert string to IEnumerable<>

According to my workflow i am getting the data from the queue which is type of string and i need to loop it using parallel for each which requires type of IEnumerable.
Is there any way to convert string to IEnumerable<> ?

Hi @Tharatharan

Please elaborate.

Do you want to convert the string into array of characters like this

“string” → {“s”, “t”, “r”, “i”, “n”, “g”}

or there is a complete sentence and you want to break it at spaces

“this is string” → {“this”, “is”, “string”}

Hi @Tharatharan
since item ua re using is a queue which is of datatype queueitem, to access its values u had to use

queueitemvariable.GetSpecificContent which is of dictionary type (Key: String, Value:Object)

for that cases, you can try this way
check this workflow for sample
Main.xaml (11.4 KB)

You just need to know how to iterate through a dictionary of String,Object key value pairs

Regards,
Nived N

i have used queueitemvariable.GetSpecificContent after getting item form the queue but when i use parallel for loop only it shows can’t convert convert string to IEnumerable

Hi try like as below
Main.xaml (10.7 KB)

Regards,
Nived N

Hi @kumar.varun2 ,

I’m in the second case. I’m struggling with this. I have a list of values inside a string in the form

{“hello”, “good morning”, “bye”}

I want to iterate over in a For Each.

I’ve seen it being used written it literally as I showed you above in the activity text input, but when passing it in a string variable, it’s getting and processing each character from the string individually (that’s it, “{”, then “h”, then “e” and the like).

I’ve been trying both with the plain string and casting it like
CType(myStringVar.ToString,IEnumerable)

with the same results.

better to split your case off from the origin topic.

For sure when it is a flat string, then loop will iterate over the chars.
Flat strings we would split

Hi namesake,

Sorry but still I can’t figure it out.

You have the format of my string. It’s like in this format:

{“this”, “is”, “string”}

and it’s inside a string type variable.

The question is clear enough. How do I convert it in a suitable way that For Each can iterate over “this”, “is” and “string”?

@pere
Answers were short and clear

grafik
And Also with Trimmings
grafik

1 Like