# Converting str array to int array

**URL:** <https://forum.uipath.com/t/converting-str-array-to-int-array/97640>\
**Category:** Help\
**Tags:** system, activities\
**Created:** [February 25, 2019, 5:51am UTC](https://forum.uipath.com/t/converting-str-array-to-int-array/97640 "2019-02-25T05:51:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Khim\_Villamor](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/khim_villamor/32/176824_2.png) [@Khim\_Villamor](https://forum.uipath.com/u/Khim_Villamor)\
**Post date:** [February 25, 2019, 5:51am UTC](https://forum.uipath.com/t/converting-str-array-to-int-array/97640/1 "2019-02-25T05:51:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anil5](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil5/32/48965_2.png) [@anil5](https://forum.uipath.com/u/anil5)\
**Post date:** [February 25, 2019, 5:57am UTC](https://forum.uipath.com/t/converting-str-array-to-int-array/97640/2 "2019-02-25T05:57:20Z")

</div>

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

> **[Array Variables](https://docs.uipath.com/studio/docs/array-variables)**
>
> The array variable is a type of variable which enables you to store multiple values of the same type. UiPath Studio supports as many types of arrays as it does types of variables. This means that you can create an array of numbers, one of strings,...

---

<div class="post-metadata">

**Author:** ![nimin](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nimin/32/44338_2.png) [@nimin](https://forum.uipath.com/u/nimin)\
**Post date:** [February 25, 2019, 6:11am UTC](https://forum.uipath.com/t/converting-str-array-to-int-array/97640/3 "2019-02-25T06:11:18Z")

</div>

Hi @Khim_Villamor,

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

Warm regards,  
Nimin

---

<div class="post-metadata">

**Author:** ![Khim\_Villamor](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/khim_villamor/32/176824_2.png) [@Khim\_Villamor](https://forum.uipath.com/u/Khim_Villamor)\
**Post date:** [February 25, 2019, 6:59am UTC](https://forum.uipath.com/t/converting-str-array-to-int-array/97640/4 "2019-02-25T06:59:37Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![nimin](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nimin/32/44338_2.png) [@nimin](https://forum.uipath.com/u/nimin)\
**Post date:** [February 25, 2019, 7:33am UTC](https://forum.uipath.com/t/converting-str-array-to-int-array/97640/5 "2019-02-25T07:33:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ranjit\_Nayak1](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ranjit_nayak1/32/282049_2.png) [@Ranjit\_Nayak1](https://forum.uipath.com/u/Ranjit_Nayak1)\
**Post date:** [January 8, 2023, 1:30pm UTC](https://forum.uipath.com/t/converting-str-array-to-int-array/97640/6 "2023-01-08T13:30:06Z")

</div>

> [@nimin](#):
>
> cint(x.trim)

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

---

<div class="post-metadata">

**Author:** ![Yameso](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yameso/32/375916_2.png) [@Yameso](https://forum.uipath.com/u/Yameso)\
**Post date:** [March 15, 2023, 9:09pm UTC](https://forum.uipath.com/t/converting-str-array-to-int-array/97640/7 "2023-03-15T21:09:25Z")

</div>

Write example array which doesn’t work for you
