How to Split a String



I am trying to split a string on string ‘not’ . String is “This is not a game” is in variable PDFVariable. So I use a variable Var of type String[] and assign as PDFVariable.ToString().Split(‘not’) and trying to see the output in Var(1). But I am getting error in the Assign box.

Extracting letters from a word/string
How to split at 4 consequent spaces?

Can you send what error message are you getting when u hover on the blue warning.

May be you cannot use Var as a variable,try something else.



Did you try double quotes for not instead of single?

–> “not”


Does not work on “not”


Hi Sampad ,

use can use

or you can use “Split string” activity in Expressions

How to split data using UiPath studio activities?

Thanks Uday !! Works fine !


Hi @sampaddas,

You can try this StringVaraible.Split({“not”},StringSplitOptions.None)

Vikas Reddy :slight_smile:

How to split data using UiPath studio activities?

Variable.Split({“not”},StringSplitOptions.None)…Try with this This will work…



I have a similar problem also, and I cannot get it to work with these tips. I would have to split a string by empty lines. Heres an example of a string:

Name 2
Name 345
Name 1

Name 1
Name 2
Name 3

So, I would have to split it from where ever there’s an empty line. So it would become two strings:

Name 2
Name 345
Name 1


Name 1
Name 2
Name 3

I tried intructions from here:
but I could not get it to work with UiPath. I tried
but it doesn’t work.

Anyone have an idea what could I do? Expertise would be appreciated! Thank you very much!


Actually I got this to work!

text.Split({Environment.NewLine + Environment.NewLine},stringsplitoptions.none)

So, Environment.NewLine works atleast on a .txt file.


you can use

text.Split(new string[ ] {Environment.NewLine + Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)

The combined Environment.NewLine + Environment.NewLine as this will only split when a new line is also followed by a new line and split accordingly.

String[ ] people = text.Split(new string[] { “\r\n\r\n” },StringSplitOptions.RemoveEmptyEntries);

This will also work.


How to split data using UiPath studio activities?

Okay, thank you much!


there is a split activity… we can specify the property based on which we should split like space, tab or new line… if we use that activity it will be easy no need of coding required…

String splitting advice does not work

I know this is a old post, however I was stuck in split string and was working on resolution which I wanted to share. I wanted to get the file name using the “Path.GetFileName” function into a single variable. the sample workflow works fine, you just need to specify the complete path along with the file name under “Path.GetFileName” function. Sample (2.2 KB)


I don’t see a “Split” activity in my list.

For the love of god… splitting a string shouldn’t be so nuanced that it requires this much discussion :-/

Given SomeString contains a multi-word string, I tried simply using the Assign activity to assign SomeString.Split(" ") to a string array variable… and I keep getting the an error “Option Strict On disallows implicit conversions from string to char”.

I ended up having to Google the error message and change my approach to SomeString.Split(Convert.ToChar(" "))


Yeah, the Split function requires a character or character array.
Alternatively you can use ‘c’ or (0) to indicate that it’s a character.
SomeString.Split(" "c) or SomeString.Split(" "(0))

You can also use a string wtih brackets to make it an array.
SomeString.Split({" "},System.StringSplitOptions.None)
and the string can be anything. System.StringSplitOptions.RemoveEmptyEntries will also get rid of empty items.

Hope that gives you some additional info!



I don’t use VB much so I totally missed the () after String in this signature. That definitely clears it up.




actual str=“123-456-6789”

i need to split like this dynamically


pls send me how to split and save it to another variable


Hello @Venkatp,

You can use Microsoft.Activities.Expressions.SplitString Activity or String.Split Method. In both cases the result is an array of strings

SplitStringActivity.xaml (5.9 KB)
SplitStringAssign.xaml (6.1 KB)