# "Split String" Activity

**URL:** <https://forum.uipath.com/t/split-string-activity/5696>\
**Category:** Help\
**Tags:** system, activities\
**Created:** [June 2, 2017, 5:29am UTC](https://forum.uipath.com/t/split-string-activity/5696 "2017-06-02T05:29:07Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![dileeps](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dileeps](https://forum.uipath.com/u/dileeps)\
**Post date:** [June 2, 2017, 5:29am UTC](https://forum.uipath.com/t/split-string-activity/5696/1 "2017-06-02T05:29:07Z")

</div>

Hi Team,

How to use split string activity ?

I tried giving the input as a string variable consisting of a value, and the result as an array of string.

Input: “DE-123”  
Result: test  
separator: “-”

I tried printing the test as test.ToString but it is giving as System.String.

Please help asap.

Thanks in advance  
Dileep. S

 ![](https://global.discourse-cdn.com/uipath/original/2X/d/d859838f2336ef0a40c8d12d81ff689187438d23.jpg)  
 ![](https://global.discourse-cdn.com/uipath/original/2X/7/7c38224e510271a094032060c7f50c73f1529f17.JPG)

---

<div class="post-metadata">

**Author:** ![aksh1yadav](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/aksh1yadav/32/135359_2.png) [@aksh1yadav](https://forum.uipath.com/u/aksh1yadav)\
**Post date:** [June 2, 2017, 5:34am UTC](https://forum.uipath.com/t/split-string-activity/5696/2 "2017-06-02T05:34:50Z")

</div>

Hey @dileeps

Try this 🙂 [split\_string\_activity.xaml](https://global.discourse-cdn.com/uipath/original/2X/f/f93215ab6f3891d2719ef5c08deb26100bef05d9.xaml) (5.3 KB)

It returns a **String[]** array so to get values you have to access them by using array index.

Regards…!!  
Aksh

---

<div class="post-metadata">

**Author:** ![dileeps](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dileeps](https://forum.uipath.com/u/dileeps)\
**Post date:** [June 2, 2017, 5:44am UTC](https://forum.uipath.com/t/split-string-activity/5696/3 "2017-06-02T05:44:18Z")

</div>

Hi @aksh1yadav

Thanx man. Thats totally working fine. 🙂

Regards  
Dileep

---

<div class="post-metadata">

**Author:** ![dileeps](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dileeps](https://forum.uipath.com/u/dileeps)\
**Post date:** [June 2, 2017, 11:12am UTC](https://forum.uipath.com/t/split-string-activity/5696/4 "2017-06-02T11:12:07Z")

</div>

hi @aksh1yadav,

Can you please help me in this.

I am reading a string from the screen, and using split string i divided the string.

“LU - LUXEMBOURG”  
using split string and delimiter as " - " which results in LU and LUXEMBOURG. I want to use the second string. So as you mentioned above i assigned riskgeo(1).tostring to a variable.

But, this is not working fine at times and getting the below mentioned error in the workflow. If I run the same workflow again without any changes, it works fine.

Please help me. Find the image below.

Thanks  
Dileep. S

 ![](https://global.discourse-cdn.com/uipath/original/2X/d/d287e12371de30aefe4477708180a0cff5c85359.JPG)

---

<div class="post-metadata">

**Author:** ![vvaidya](https://avatars.discourse-cdn.com/v4/letter/v/e56c9b/32.png) [@vvaidya](https://forum.uipath.com/u/vvaidya)\
**Post date:** [June 2, 2017, 11:24am UTC](https://forum.uipath.com/t/split-string-activity/5696/5 "2017-06-02T11:24:43Z")

</div>

Its a good practice to validate the existence of data before you perform split.In your case, get text variable.

for eg:

` if(string.IsNullorEmpty(str))`

```
if(str.Contails("-"))

arrstr = Split(str,"-")

if(arrstr.length> 1)

Name = arrstr(1).Tostring

```

---

<div class="post-metadata">

**Author:** ![dileeps](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dileeps](https://forum.uipath.com/u/dileeps)\
**Post date:** [June 2, 2017, 11:29am UTC](https://forum.uipath.com/t/split-string-activity/5696/6 "2017-06-02T11:29:00Z")

</div>

Hi @vvaidya

The string will not be empty. After posting the above error, I just ran the workflow and it worked fine 😕

So, and the string will not be empty. what else do you want me to check. The workflow is getting stopped at the assign activity.

Regards  
Dileep. S

---

<div class="post-metadata">

**Author:** ![vvaidya](https://avatars.discourse-cdn.com/v4/letter/v/e56c9b/32.png) [@vvaidya](https://forum.uipath.com/u/vvaidya)\
**Post date:** [June 2, 2017, 11:30am UTC](https://forum.uipath.com/t/split-string-activity/5696/7 "2017-06-02T11:30:32Z")

</div>

**if(str.Contails(“-”))**

arrstr = Split(str,“-”)

**if(arrstr.length\> 1)**

---

<div class="post-metadata">

**Author:** ![aksh1yadav](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/aksh1yadav/32/135359_2.png) [@aksh1yadav](https://forum.uipath.com/u/aksh1yadav)\
**Post date:** [June 2, 2017, 11:42am UTC](https://forum.uipath.com/t/split-string-activity/5696/8 "2017-06-02T11:42:58Z")

</div>

Just make sure the data is not empty. so may be get text is not able to get data everytime may be page load uncomplete or internet slow connection. use write line to check data is coming or not and put conditions before it to make sure no error as @vvaidya mentioned.

---

<div class="post-metadata">

**Author:** ![dileeps](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dileeps](https://forum.uipath.com/u/dileeps)\
**Post date:** [June 2, 2017, 11:44am UTC](https://forum.uipath.com/t/split-string-activity/5696/9 "2017-06-02T11:44:52Z")

</div>

Yea guys… I have checked. get text is work is not working fine because the indexes are being changed from time to time.

Thanks for your suggestions 🙂

Regards  
Dileep. S

---

<div class="post-metadata">

**Author:** ![Volodya](https://avatars.discourse-cdn.com/v4/letter/v/a6a055/32.png) [@Volodya](https://forum.uipath.com/u/Volodya)\
**Post date:** [July 27, 2017, 9:56am UTC](https://forum.uipath.com/t/split-string-activity/5696/10 "2017-07-27T09:56:46Z")

</div>

Many thanks, this example helped me a lot!

---

<div class="post-metadata">

**Author:** ![Pema\_Sherpa](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pema_sherpa/32/43481_2.png) [@Pema\_Sherpa](https://forum.uipath.com/u/Pema_Sherpa)\
**Post date:** [March 21, 2018, 6:38pm UTC](https://forum.uipath.com/t/split-string-activity/5696/11 "2018-03-21T18:38:22Z")

</div>

Split string activity is not included in 2018 studio, does anyone know why?

---

<div class="post-metadata">

**Author:** ![andrzej.kniola](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/andrzej.kniola/32/8835_2.png) [@andrzej.kniola](https://forum.uipath.com/u/andrzej.kniola)\
**Post date:** [March 21, 2018, 10:49pm UTC](https://forum.uipath.com/t/split-string-activity/5696/12 "2018-03-21T22:49:47Z")

</div>

> [@SplitString Activity Missing in 2018.1.2?](https://forum.uipath.com/t/splitstring-activity-missing-in-2018-1-2/26436):
>
> UiPath Gurus, I recently upgraded UiPath Studio from a 2017 version to the latest, 2018.1.2 version. Then I noticed that automations I created using the Split String Activity would fail to load in the action. I found a thread indicating that I needed to install the Microsoft.Activities.Extension package, which I did, but no Split String. Thinking there was something corrupt about my installation, I installed UiPath on a fresh VM and created an empty project. Again there was no split string …

---

<div class="post-metadata">

**Author:** ![skkumar2020](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@skkumar2020](https://forum.uipath.com/u/skkumar2020)\
**Post date:** [April 4, 2018, 5:10am UTC](https://forum.uipath.com/t/split-string-activity/5696/13 "2018-04-04T05:10:46Z")

</div>

Even we are facing same issue. The workflows developed in older versions of UiPath & opened in newer versions, which is showing error in existing activities position even though activity is already imported and available in activities pane. Let us know how to eliminate this error .

Regards,  
Shreekrishna

---

<div class="post-metadata">

**Author:** ![kevstu02](https://avatars.discourse-cdn.com/v4/letter/k/e79b87/32.png) [@kevstu02](https://forum.uipath.com/u/kevstu02)\
**Post date:** [July 17, 2018, 5:27am UTC](https://forum.uipath.com/t/split-string-activity/5696/14 "2018-07-17T05:27:35Z")

</div>

Any Update on this?

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [October 29, 2018, 9:18am UTC](https://forum.uipath.com/t/split-string-activity/5696/15 "2018-10-29T09:18:04Z")

</div>


