How to remove spaces in the array

how to remove spaces in the array

1 Like

Hi @Sweety_Girl
try that StrArray.Trim

or Split(" ".ToCharArray)

Thanks
Ashwin S

3 Likes

Hi @Sweety_Girl

you can do this easily if you convert the array to a List.

ListVariable = ArrayName.ToList()

now, use a For Each loop to access each element of the list to check for spaces.

If you want to remove leading and trailing spaces in the elements that already have a value, use of for each loop is ideal to check each individually.

If you want to remove elements that are empty or blank, that can also be done through invoke method activity by calling RemoveAll method.

Hope it helps

2 Likes

Hi @Sweety_Girl

Try this
arrVar = arrVar.Select(Function(s) s.Replace(" ",string.Empty)).ToArray()

2 Likes

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