# Extract specific Substring from a string

**URL:** <https://forum.uipath.com/t/extract-specific-substring-from-a-string/718139>\
**Category:** Studio\
**Tags:** string-manipulation, string, question, studio, activities\
**Created:** [February 8, 2024, 4:33am UTC](https://forum.uipath.com/t/extract-specific-substring-from-a-string/718139 "2024-02-08T04:33:24Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yugal\_Raju](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yugal_raju/32/268628_2.png) [@Yugal\_Raju](https://forum.uipath.com/u/Yugal_Raju)\
**Post date:** [February 8, 2024, 4:33am UTC](https://forum.uipath.com/t/extract-specific-substring-from-a-string/718139/1 "2024-02-08T04:33:24Z")

</div>

Hello all,

I want to get a substring “1234659” from String variable : “000000001234659100”.

please help with the syntax for extracting the substring.

---

<div class="post-metadata">

**Author:** ![rlgandu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rlgandu/32/488436_2.png) [@rlgandu](https://forum.uipath.com/u/rlgandu)\
**Post date:** [February 8, 2024, 4:34am UTC](https://forum.uipath.com/t/extract-specific-substring-from-a-string/718139/2 "2024-02-08T04:34:43Z")

</div>

> [@Yugal\_Raju](#):
>
> I want to get a substring “1234659” from String variable : “000000001234659100”.
> 
> please help with the syntax for extracting the substring.

@Yugal_Raju

strVariable.Substring(strVariable.IndexOf(“1234659”), 7)

or

yourStringVariable.Substring(yourStringVariable.IndexOf(“1”), 7)

 ![image](https://global.discourse-cdn.com/uipath/original/4X/f/0/8/f08e20354c269d110b2fb1d9cc230e9160fe7331.png)

---

<div class="post-metadata">

**Author:** ![tazunnisa.badavide](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/tazunnisa.badavide/32/419354_2.png) [@tazunnisa.badavide](https://forum.uipath.com/u/tazunnisa.badavide)\
**Post date:** [February 8, 2024, 4:35am UTC](https://forum.uipath.com/t/extract-specific-substring-from-a-string/718139/4 "2024-02-08T04:35:44Z")

</div>

> [@Yugal\_Raju](#):
>
> 000000001234659100

@Yugal_Raju

> StringVal.Substring(8,7)

---

<div class="post-metadata">

**Author:** ![lrtetala](https://avatars.discourse-cdn.com/v4/letter/l/e19b73/32.png) [@lrtetala](https://forum.uipath.com/u/lrtetala)\
**Post date:** [February 8, 2024, 4:36am UTC](https://forum.uipath.com/t/extract-specific-substring-from-a-string/718139/5 "2024-02-08T04:36:39Z")

</div>

> [@Yugal\_Raju](#):
>
> “000000001234659100”

Hi @Yugal_Raju

`strVariable.TrimStart("0"c).TrimEnd("0"c)`

 ![image](https://global.discourse-cdn.com/uipath/original/4X/1/0/f/10ff93e0c62133d95d70ec996257e7bda8515457.png)

---

<div class="post-metadata">

**Author:** ![vrdabberu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vrdabberu/32/484365_2.png) [@vrdabberu](https://forum.uipath.com/u/vrdabberu)\
**Post date:** [February 8, 2024, 4:36am UTC](https://forum.uipath.com/t/extract-specific-substring-from-a-string/718139/6 "2024-02-08T04:36:41Z")

</div>

> [@Yugal\_Raju](#):
>
> I want to get a substring “1234659” from String variable : “000000001234659100”.
> 
> please help with the syntax for extracting the substring.

HI @Yugal_Raju

Use the below syntax

```auto
Input.TrimStart("0"c) 

Input.TrimEnd("0"c)

```

Regards

---

<div class="post-metadata">

**Author:** ![mkankatala](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/mkankatala/32/484097_2.png) [@mkankatala](https://forum.uipath.com/u/mkankatala)\
**Post date:** [February 8, 2024, 4:39am UTC](https://forum.uipath.com/t/extract-specific-substring-from-a-string/718139/7 "2024-02-08T04:39:11Z")

</div>

Hi @Yugal_Raju

You can use the below expression by Substring,

```auto
- Input = "000000001234659100"

- Output = Input.Substring(8,7)

```

Check the below workflow for better understanding,

 ![image](https://global.discourse-cdn.com/uipath/original/4X/4/4/a/44aa76eb596559e3e49df467effc2a086272a1a8.png)

Hope it helps!!

---

<div class="post-metadata">

**Author:** ![neha.upase](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/neha.upase/32/402674_2.png) [@neha.upase](https://forum.uipath.com/u/neha.upase)\
**Post date:** [February 8, 2024, 4:50am UTC](https://forum.uipath.com/t/extract-specific-substring-from-a-string/718139/8 "2024-02-08T04:50:32Z")

</div>

Hi,

you can use below expression.

originalString.Substring(originalString.IndexOf(“1234659”), 7)

 ![image](https://global.discourse-cdn.com/uipath/original/4X/8/c/9/8c9174ca20828c056324b68432b1e37e51f5c8a3.png)

---

<div class="post-metadata">

**Author:** ![Nawazish\_Ahmad](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nawazish_ahmad/32/262848_2.png) [@Nawazish\_Ahmad](https://forum.uipath.com/u/Nawazish_Ahmad)\
**Post date:** [February 8, 2024, 4:54am UTC](https://forum.uipath.com/t/extract-specific-substring-from-a-string/718139/9 "2024-02-08T04:54:58Z")

</div>

Hi @Yugal_Raju

StrInput=` "000000001234659100"`

Try this

> **`StrInput.TrimStart("0"c).TrimEnd("0"c)`**

Output= **12346591**

**OR**

> **`StrInput.Substring(8,7)`**

Output= **1234659**

Hope it will helps you 🙂  
Cheers!!

---

<div class="post-metadata">

**Author:** ![Yugal\_Raju](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yugal_raju/32/268628_2.png) [@Yugal\_Raju](https://forum.uipath.com/u/Yugal_Raju)\
**Post date:** [February 8, 2024, 4:57am UTC](https://forum.uipath.com/t/extract-specific-substring-from-a-string/718139/10 "2024-02-08T04:57:42Z")

</div>

It is working,

Thank you

---

<div class="post-metadata">

**Author:** ![mkankatala](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/mkankatala/32/484097_2.png) [@mkankatala](https://forum.uipath.com/u/mkankatala)\
**Post date:** [February 8, 2024, 4:58am UTC](https://forum.uipath.com/t/extract-specific-substring-from-a-string/718139/11 "2024-02-08T04:58:49Z")

</div>

It’s my pleasure… @Yugal_Raju

Happy Automation!!

---

<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:** [February 11, 2024, 4:59am UTC](https://forum.uipath.com/t/extract-specific-substring-from-a-string/718139/12 "2024-02-11T04:59:15Z")

</div>

Closed on February 11, 2024, 4:59am UTC

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