# Split Text

**URL:** <https://forum.uipath.com/t/split-text/38009>\
**Category:** Help\
**Tags:** system, activities\
**Created:** [June 27, 2018, 10:36am UTC](https://forum.uipath.com/t/split-text/38009 "2018-06-27T10:36:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gokulvasant](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gokulvasant/32/263239_2.png) [@gokulvasant](https://forum.uipath.com/u/gokulvasant)\
**Post date:** [June 27, 2018, 10:36am UTC](https://forum.uipath.com/t/split-text/38009/1 "2018-06-27T10:36:31Z")

</div>

Hi Guys,

Need your help on following split text, I would like split the text before word contains “Address” example:  
“Gokul Vasan Address Chennai” - I want to extract “Gokul Vasan” only

“Shankar Address Chennai” - I want to extract “Shankar” only

“James Anton Prince Address Delhi” - I want to extract “James Anton Prince” only.

Can any one help me out on this.

Thank you,  
Gokul.

---

<div class="post-metadata">

**Author:** ![Rishabh\_Lakhera](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rishabh_lakhera/32/21805_2.png) [@Rishabh\_Lakhera](https://forum.uipath.com/u/Rishabh_Lakhera)\
**Post date:** [June 27, 2018, 10:59am UTC](https://forum.uipath.com/t/split-text/38009/2 "2018-06-27T10:59:19Z")

</div>

Hey @gokulvasant,

Assuming str is the string contains “Shankar Address Chennai”

You can use **str.Split({“Address”},System.StringSplitOptions.None)(0)**  
This will get you whatever comes before “Address” just like you need it 🙂

Regards.

---

<div class="post-metadata">

**Author:** ![thediabloman](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/thediabloman/32/10422_2.png) [@thediabloman](https://forum.uipath.com/u/thediabloman)\
**Post date:** [June 27, 2018, 12:15pm UTC](https://forum.uipath.com/t/split-text/38009/3 "2018-06-27T12:15:36Z")

</div>

I would use a regex for that.

`System.Text.RegularExpressions.Regex.Match(variablestring, "^.*?(?= Address)").ToString()`

This will get everything from the start of a string until " Address" is found.  
An advantage of this solution is that it wont find matches that do not contain " Address".

---

<div class="post-metadata">

**Author:** ![sarathi125](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sarathi125/32/519448_2.png) [@sarathi125](https://forum.uipath.com/u/sarathi125)\
**Post date:** [June 27, 2018, 1:08pm UTC](https://forum.uipath.com/t/split-text/38009/4 "2018-06-27T13:08:43Z")

</div>

Hi @gokulvasant,

Try using substring of the text available in the textbox like the following,

strAddress.Substring(0, strAddress.IndexOf(“Address”))

This will give you the text before “Address” from the entire text.

---

<div class="post-metadata">

**Author:** ![gokulvasant](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gokulvasant/32/263239_2.png) [@gokulvasant](https://forum.uipath.com/u/gokulvasant)\
**Post date:** [June 27, 2018, 1:20pm UTC](https://forum.uipath.com/t/split-text/38009/5 "2018-06-27T13:20:16Z")

</div>

Thank you all…

It’s working like a charm. Once again thank you guyz…

---

<div class="post-metadata">

**Author:** ![gokulvasant](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gokulvasant/32/263239_2.png) [@gokulvasant](https://forum.uipath.com/u/gokulvasant)\
**Post date:** [June 27, 2018, 1:49pm UTC](https://forum.uipath.com/t/split-text/38009/6 "2018-06-27T13:49:06Z")

</div>

Hi Guyz,

One more thing I have sequence of rows like follows:  
Paid Paid by Company  
Paid $1000 CTD $5,000.25 remaining $2,000.00 Amount  
Paid Same Paid by Consumer  
Paid $250 CTD $4,250.25 remaining $3,500.00 Amount

I this I want to split into 3 columns or variables only if I get payment / amount details i.e., 2 and 4 fourth row only. If I get only content means I want to leave as it is.  
I want to leave this row “Paid Paid by Company” as it is  
then I want to split to this “Paid $1000 CTD $5,000.25 remaining $2,000.00 Amount”  
like “$1000” “$5,000.25” and 2,000.00

Am trying to use Split string activity but it throwing error like : Assign : Index was outside the bounds of the array. in some times.

Please let me know how to achieve the same.

Thank you,  
Gokul.

---

<div class="post-metadata">

**Author:** ![thediabloman](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/thediabloman/32/10422_2.png) [@thediabloman](https://forum.uipath.com/u/thediabloman)\
**Post date:** [June 27, 2018, 3:19pm UTC](https://forum.uipath.com/t/split-text/38009/7 "2018-06-27T15:19:31Z")

</div>

Once again you can use Regex to pick out the specific numbers. Either that or the substring + index of that Sarathi125 suggested

---

<div class="post-metadata">

**Author:** ![niteshn](https://avatars.discourse-cdn.com/v4/letter/n/3bc359/32.png) [@niteshn](https://forum.uipath.com/u/niteshn)\
**Post date:** [June 28, 2018, 1:59pm UTC](https://forum.uipath.com/t/split-text/38009/8 "2018-06-28T13:59:26Z")

</div>

Hi - Use the following regex’s to extract Amounts-  
With Decimal Amounts(like $5,000.25, $2,000.00) - “[$][\d,]+[\s,.]\d{2}”  
Without decimal - “[$]\d{3}”

Thanks,  
Nitesh

---

<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:19am UTC](https://forum.uipath.com/t/split-text/38009/9 "2018-10-29T09:19:28Z")

</div>

Closed on October 29, 2018, 9:19am UTC


