# Split Synatx error

**URL:** <https://forum.uipath.com/t/split-synatx-error/170507>\
**Category:** Help\
**Tags:** string, data-manipulation, question, system, activities\
**Created:** [November 22, 2019, 1:50am UTC](https://forum.uipath.com/t/split-synatx-error/170507 "2019-11-22T01:50:05Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![NikhilRPA](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nikhilrpa/32/176896_2.png) [@NikhilRPA](https://forum.uipath.com/u/NikhilRPA)\
**Post date:** [November 22, 2019, 1:50am UTC](https://forum.uipath.com/t/split-synatx-error/170507/1 "2019-11-22T01:50:05Z")

</div>

Hello Guys, I am getting below error

 ![11%20PM](https://global.discourse-cdn.com/uipath/original/3X/4/d/4db307e17f7092a324ae33dcd9aed4b2737ea7d5.png)

Can anyone help, where I am getting wrong

---

<div class="post-metadata">

**Author:** ![Lahiru.Fernando](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/lahiru.fernando/32/523857_2.png) [@Lahiru.Fernando](https://forum.uipath.com/u/Lahiru.Fernando)\
**Post date:** [November 22, 2019, 2:01am UTC](https://forum.uipath.com/t/split-synatx-error/170507/2 "2019-11-22T02:01:16Z")

</div>

Hello @NikhilRPA

What is the data type of the variable text? It should be of type string.

Change that and see whether this works.

You can also try this way

Text.Split(" "c)

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [November 22, 2019, 2:08am UTC](https://forum.uipath.com/t/split-synatx-error/170507/3 "2019-11-22T02:08:36Z")

</div>

Hi,

String.Split method returns string array, so` text = text.split(CChar(" "))` is wrong sentence  
You need to write like the following.

`stringArrayVar = stringVar.Split.split(CChar(" "))`  
or  
`text = text.Split.split(CChar(" "))(0)`  
(text should be String type)

Regards,

---

<div class="post-metadata">

**Author:** ![pattyricarte](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pattyricarte/32/81346_2.png) [@pattyricarte](https://forum.uipath.com/u/pattyricarte)\
**Post date:** [November 22, 2019, 2:17am UTC](https://forum.uipath.com/t/split-synatx-error/170507/4 "2019-11-22T02:17:27Z")

</div>

Can we see the value that you wanted to split. ? @NikhilRPA

By the way for your reference kindly see the article below.

> [@How to manipulate a part of string: Split, Trim, Substring, Replace, Remove, Left, Right](https://forum.uipath.com/t/how-to-manipulate-a-part-of-string-split-trim-substring-replace-remove-left-right/140180):
>
> Hi, if you are a beginner in the world of automation and would like to know how you can manipulate text based on the solutions available in the [VB.NET](http://VB.NET) code and using REGEX (regular expressions) then you are in the right place. In the topic below, you will learn how to easily extract data from any part of the search text using various methods. The topic includes solution examples with descriptions and graphics to better understand the topic for functions such as: Split Substring Left Right R…

cheers 😃

Happy learning 😃

---

<div class="post-metadata">

**Author:** ![NikhilRPA](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nikhilrpa/32/176896_2.png) [@NikhilRPA](https://forum.uipath.com/u/NikhilRPA)\
**Post date:** [November 22, 2019, 2:41am UTC](https://forum.uipath.com/t/split-synatx-error/170507/5 "2019-11-22T02:41:02Z")

</div>

@Lahiru.Fernando Hi, The datatype for the variable text is Array(String)

 ![09%20PM](https://global.discourse-cdn.com/uipath/original/3X/7/7/7785dc96352e07141d8aa153a868c882950baf95.png)

I am getting same error if I use the syntax you told

---

<div class="post-metadata">

**Author:** ![NikhilRPA](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nikhilrpa/32/176896_2.png) [@NikhilRPA](https://forum.uipath.com/u/NikhilRPA)\
**Post date:** [November 22, 2019, 2:42am UTC](https://forum.uipath.com/t/split-synatx-error/170507/6 "2019-11-22T02:42:03Z")

</div>

@pattyricarte I wanted to split the word “City Hyderabad”

---

<div class="post-metadata">

**Author:** ![pattyricarte](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pattyricarte/32/81346_2.png) [@pattyricarte](https://forum.uipath.com/u/pattyricarte)\
**Post date:** [November 22, 2019, 2:44am UTC](https://forum.uipath.com/t/split-synatx-error/170507/7 "2019-11-22T02:44:14Z")

</div>

Hi @NikhilRPA

Use this StringVariable.split(" "c) and pass it to array and you will get the value using index 0 and 1 😃

As i can see to your respond to @Lahiru.Fernando the data type of th string is array.

So no need for you to split it ryt.You just need to use the index in the array of use for each to get the value.

cheers 😃

Happy learning 😃

---

<div class="post-metadata">

**Author:** ![NikhilRPA](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nikhilrpa/32/176896_2.png) [@NikhilRPA](https://forum.uipath.com/u/NikhilRPA)\
**Post date:** [November 22, 2019, 2:44am UTC](https://forum.uipath.com/t/split-synatx-error/170507/8 "2019-11-22T02:44:17Z")

</div>

@Yoichi- Hey but in the video of tutorial about split, it work’s fine with same syntax i posted

[![](https://global.discourse-cdn.com/uipath/original/4X/3/d/f/3df0faf94b6a57ff64a517c395886081d253c889.jpeg "UiPath Tutorials For Beginners - String Operations") ](https://www.youtube.com/watch?v=xYcdNgXVVns)

---

<div class="post-metadata">

**Author:** ![NikhilRPA](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nikhilrpa/32/176896_2.png) [@NikhilRPA](https://forum.uipath.com/u/NikhilRPA)\
**Post date:** [November 22, 2019, 2:46am UTC](https://forum.uipath.com/t/split-synatx-error/170507/9 "2019-11-22T02:46:07Z")

</div>

@pattyricarte- If you see the above screen shot I posted with error using the same syntax text.split(" "c)

---

<div class="post-metadata">

**Author:** ![pattyricarte](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pattyricarte/32/81346_2.png) [@pattyricarte](https://forum.uipath.com/u/pattyricarte)\
**Post date:** [November 22, 2019, 2:47am UTC](https://forum.uipath.com/t/split-synatx-error/170507/10 "2019-11-22T02:47:00Z")

</div>

Yah i saw it i edit my post.Just use foreach for it and you will get the value or index @NikhilRPA

cheers 😃

Happy learning

---

<div class="post-metadata">

**Author:** ![NikhilRPA](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nikhilrpa/32/176896_2.png) [@NikhilRPA](https://forum.uipath.com/u/NikhilRPA)\
**Post date:** [November 22, 2019, 2:56am UTC](https://forum.uipath.com/t/split-synatx-error/170507/11 "2019-11-22T02:56:58Z")

</div>

No I just want to spilt the words by using space as delimeter and send that split values into array variable and display using for each

Text= text.split(" ",c)

---

<div class="post-metadata">

**Author:** ![pattyricarte](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pattyricarte/32/81346_2.png) [@pattyricarte](https://forum.uipath.com/u/pattyricarte)\
**Post date:** [November 22, 2019, 3:00am UTC](https://forum.uipath.com/t/split-synatx-error/170507/12 "2019-11-22T03:00:43Z")

</div>

But as you mentioned it was an array of string so my perception no need to split it.Because when you use the text.split it will create an array of string.!

you just need to text(0).ToString or text(1).ToString to get the value or you can use Foreach to iterate in the array of string and easily get the value.

cheers 😃

Happy learning 😃

---

<div class="post-metadata">

**Author:** ![NikhilRPA](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nikhilrpa/32/176896_2.png) [@NikhilRPA](https://forum.uipath.com/u/NikhilRPA)\
**Post date:** [November 22, 2019, 3:04am UTC](https://forum.uipath.com/t/split-synatx-error/170507/13 "2019-11-22T03:04:29Z")

</div>

Got you thanks @pattyricarte

---

<div class="post-metadata">

**Author:** ![pattyricarte](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pattyricarte/32/81346_2.png) [@pattyricarte](https://forum.uipath.com/u/pattyricarte)\
**Post date:** [November 22, 2019, 3:06am UTC](https://forum.uipath.com/t/split-synatx-error/170507/14 "2019-11-22T03:06:05Z")

</div>

No worries @NikhilRPA

Happy to help here 😃

cheers 😃

Happy learning 😃

---

<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:** [November 25, 2019, 3:06am UTC](https://forum.uipath.com/t/split-synatx-error/170507/15 "2019-11-25T03:06:10Z")

</div>

Closed on November 25, 2019, 3:06am UTC

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