For Each Loop Giving Error While Looping Through An 1-Dimensional Array Of Strings (For Each: Specified cast is not valid.)

Hi, I have a string called - “Name1,Dish1;Name2,Dish2;Name3,Dish3”.

First I created an array of strings by splitting this in “;” (Semicolon). So it’ll be {“Name1,Dish1”, “Name2,Dish2”, “Name3,Dish3”}.

Now, I’m looping through this and trying to split the first string in the array i.e. Name1,Dish1. But the split function is giving me an error when I try to Loop the Array(i.e. {“Name1,Dish1”, “Name2,Dish2”, “Name3,Dish3”}) as For Each: Specified cast is not valid

Please Help

HI @manojj.yadav

You can try with For each activity

This will get the all the value : String.Join(",",Split(YourString,";"))

This will get only one value : Split(YourString,";") you can try this in the for each

Check out this XAML file

SplitArray.xaml (6.6 KB)



1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.