# How to Split String after Certain character

**URL:** <https://forum.uipath.com/t/how-to-split-string-after-certain-character/263385>\
**Category:** Activities\
**Tags:** excel, uiautomation\
**Created:** [October 20, 2020, 7:35am UTC](https://forum.uipath.com/t/how-to-split-string-after-certain-character/263385 "2020-10-20T07:35:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prathibabala](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prathibabala/32/176716_2.png) [@Prathibabala](https://forum.uipath.com/u/Prathibabala)\
**Post date:** [October 20, 2020, 7:35am UTC](https://forum.uipath.com/t/how-to-split-string-after-certain-character/263385/1 "2020-10-20T07:35:43Z")

</div>

(Split(input.ToString,“R”)(1).ToString.Trim).Replace(“,”,“.”). I have written this to split string (C2019INR30045,67) after R character. It working fine. Sometimes I will have Input String as (C2019USD567,89). How to write Split string to extract characters after **R or D.**. I don’t know How to insert OR operator in order to split string. Please help

---

<div class="post-metadata">

**Author:** ![ppr](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ppr/32/464097_2.png) [@ppr](https://forum.uipath.com/u/ppr)\
**Post date:** [October 20, 2020, 8:12am UTC](https://forum.uipath.com/t/how-to-split-string-after-certain-character/263385/2 "2020-10-20T08:12:53Z")

</div>

we can work with Regex e.g. with Groups  
 ![grafik](https://global.discourse-cdn.com/uipath/original/3X/3/1/31d396a1e559ac61dcd00ea445f50499b6dff51a.png)

---

<div class="post-metadata">

**Author:** ![supermanPunch](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supermanpunch/32/133652_2.png) [@supermanPunch](https://forum.uipath.com/u/supermanPunch)\
**Post date:** [October 20, 2020, 8:30am UTC](https://forum.uipath.com/t/how-to-split-string-after-certain-character/263385/3 "2020-10-20T08:30:39Z")

</div>

@Prathibabala An Alternate using the Split method :

Consider the input variable str = “C2019INR30045,67”

You can use the below expression in Assign Statement :

```
data = if(Split(str,"INR").Count>1,Split(str,"INR"),if(Split(str,"USD").Count>1,Split(str,"USD"),{}))

```

Where data is a variable of the type Array of String.

You can then check the data contains the Count 2, then get the data from both the parts in the below way :

```
if (data.Count=2) //If Activity
    firstHalf = data(0) //Assign Statement
    secondHalf - data(1) // Assign Statement

```

---

<div class="post-metadata">

**Author:** ![Prathibabala](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prathibabala/32/176716_2.png) [@Prathibabala](https://forum.uipath.com/u/Prathibabala)\
**Post date:** [October 20, 2020, 8:50am UTC](https://forum.uipath.com/t/how-to-split-string-after-certain-character/263385/4 "2020-10-20T08:50:56Z")

</div>

Thank you Very Much

---

<div class="post-metadata">

**Author:** ![ptrobot](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ptrobot/32/175001_2.png) [@ptrobot](https://forum.uipath.com/u/ptrobot)\
**Post date:** [October 20, 2020, 3:29pm UTC](https://forum.uipath.com/t/how-to-split-string-after-certain-character/263385/5 "2020-10-20T15:29:22Z")

</div>

Another solution is to use RegEx.Split() with the OR operator | in the regular expression.

```
data = RegEx.Split(input.ToString, "INR|USD")

```

The perk of this function is that it’s much easier to add additional currencies if you need it in the future.

```
data = RegEx.Split(input.ToString, "INR|USD|EUR|AUD")

```

Remember to import the namespace System.Text.RegularExpressions if you want to use RegEx.Split().

---

<div class="post-metadata">

**Author:** ![Dongjin\_Lee](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/dongjin_lee/32/177449_2.png) [@Dongjin\_Lee](https://forum.uipath.com/u/Dongjin_Lee)\
**Post date:** [October 20, 2020, 11:36pm UTC](https://forum.uipath.com/t/how-to-split-string-after-certain-character/263385/6 "2020-10-20T23:36:58Z")

</div>

\_Ary = {“R”, “D”}  
YourStr.Split(\_Ary, StringSplitOptions.RemoveEmptyEntries)

---

<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 12, 2020, 6:06am UTC](https://forum.uipath.com/t/how-to-split-string-after-certain-character/263385/7 "2020-11-12T06:06:40Z")

</div>

Closed on November 12, 2020, 6:06am UTC

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