List to upper and remove spaces

How to convert the list of string to upper and trim

Hey @Sweety_Girl

Use a for each loop to iterate through the list of string…
Inside the loop, use an assign activity to convert the value to upper case and trim.

Item = item.ToString.ToUpper.Trim

You try with C# functions

myList = myList.ConvertAll(d => d.ToUpper());
1 Like

Hi @Sweety_Girl,

Using the Linq , you can do it in single statement.

  • Declear a list string variable to get the result like name as lstResult.
  • Using the assign activity lstResult = lstInput.Select(Function(a) a.ToUpper()).ToList()

Regards
Balamurugan.S

2 Likes

can we also add remove whitespace in this?

Just add trim like below
lstResult = lstInput.Select(Function(a) a.ToUpper().Trim()).ToList()

2 Likes

Hi @Sweety_Girl

Use for each item in LstResult

use item.ToString.Replace(" “,”")

Thanks
Ashwin S

this one

Any idea without looping

If you want to remove all the whitespace use below code
lstResult = lstInput.Select(Function(a) a.ToUpper().Replace(" ", string.Empty)).ToList()

4 Likes

Thank you so much

2 Likes

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