Converting str array to int array

Hi. Can you teach me how to convert a string array to integer array. Thank you!

Hi,

Can you be more specific about your question.

For what i understood.

Take for each loop, for each item in arrString, convert the item to integer and use Add to collection activity to add the converted item to new collection of integer type.

Refer the below post for how to add to new collection

1 Like

Hi @Khim_Villamor,

Please assign interger array, Your_int_arr=array.ConvertAll( your_String_array,function(x) integer.Parse(x))

Warm regards,
Nimin

1 Like

Hi Nimin it says input string was not in correct format. Actually the string came from a specific column in an excel. Do you think there’s a problem there?

Hi @Khim_Villamor,

In order to make the conversion, your string array must contain integer values like this
string[4] ={ "1", "2", "3", "4" }

If your string array contains numbers with fractional part, please try this.
Assign int_array=array.ConvertAll( strarr,function(x) cint(x.trim))

Warm regards,
Nimin

3 Likes

this doesn’t work, if there is space, any solution for this please, Thanks

Write example array which doesn’t work for you