How to Use Split Function in UiPath

Formulas & functions · Updated November 23, 2026

The Split function in UiPath is a string manipulation method that divides a text string into an array of substrings based on a specified delimiter (like a comma, space, or newline). It is essential for parsing data from CSV files, log files, user inputs, or any structured text. You can use it in any activity that accepts expressions, such as Assign, Write Line, or Message Box. Before you start, you should have a basic understanding of UiPath Studio and have a project open where you can add activities.

What You’ll Need

  • UiPath Studio (Community or Enterprise) installed and a project open.
  • Basic familiarity with the UiPath interface, especially the Activities panel and the Designer panel.
  • A string variable or a literal string you want to split (e.g., “apple,banana,cherry”).

Step-by-Step

  1. Create a String Variable – In the Variables panel (usually at the bottom), click “Create Variable.” Name it inputString and set its type to String. In the Default value field, type a sample string like "apple,banana,cherry" (without the outer quotes in the value field). This variable will hold the text you want to split.
  2. Create an Array Variable – Create another variable named resultArray and set its type to String[] (array of strings). This will store the split parts. You can leave the Default value empty.
  3. Add an Assign Activity – Drag an Assign activity from the Activities panel onto the Designer panel. This activity lets you assign a value to a variable.
  4. Configure the Assign Activity – In the Assign activity’s properties, set the To field to resultArray. In the From field, enter the expression: inputString.Split(","c). Note the c after the comma – it tells UiPath to treat the comma as a character (Char) rather than a string. Click outside the field to validate; you should see no errors.
  5. Run the Workflow – Press F5 or click Run to execute. The Assign activity will split the string at each comma and store the resulting substrings in resultArray.
  6. View the Result – To verify the split, add a Message Box activity after the Assign. In its Text property, enter: String.Join(", ", resultArray). This joins the array back into a readable string. Run again – you should see “apple, banana, cherry” in the message box.
  7. Use Other Delimiters – To split by a space, use inputString.Split(" "c). For a tab, use vbTab (e.g., inputString.Split(vbTab)). For a newline, use Environment.NewLine or vbCrLf as the delimiter: inputString.Split(Environment.NewLine.ToCharArray()) – note that newline is two characters, so you need to pass a char array.
  8. Split by Multiple Delimiters – If you need to split by any of several characters (e.g., comma or semicolon), pass a char array: inputString.Split(New Char() {","c, ";"c}).
  9. Remove Empty Entries – To skip empty substrings (e.g., from consecutive delimiters), use the overload: inputString.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries).
  10. Split a String from a File or Input – You can read a file with File.ReadAllText or get user input with InputDialog, then assign that to inputString before splitting. For example, drag a Read Text File activity, set its FilePath to a CSV file, and store the result in inputString.

Common Mistakes

  • Forgetting the c suffix – If you write inputString.Split(","), UiPath throws an error because Split expects a Char or Char array, not a String. Always add c after a literal character.
  • Using the wrong variable type – The result of Split is an array of strings. If you try to assign it to a String variable, you’ll get a type mismatch error.
  • Splitting by newline incorrectly – Using Split(vbCrLf) as a single character fails because it’s two characters. Use Split(New String() {vbCrLf}, StringSplitOptions.None) or convert to a char array.
  • Ignoring empty entries – When your data has consecutive delimiters (e.g., “a,,b”), the default Split includes empty strings. If you don’t want them, use StringSplitOptions.RemoveEmptyEntries.
  • Not handling case sensitivity – Split is case-sensitive. If you need case-insensitive splitting, you’ll need to use a different approach, like Regex.Split.

Tips

  • Use StringSplitOptions.None explicitly – When using the overload with options, always specify StringSplitOptions.None or RemoveEmptyEntries to avoid confusion.
  • Test with a simple string first – Before applying to complex data, test your Split expression with a hardcoded string to ensure it works as expected.
  • Combine with LINQ for advanced processing – You can use resultArray.Where(Function(s) s.Length > 2).ToArray() to filter out short substrings.
  • Use String.Split for CSV parsing – For simple CSV lines, splitting by comma works, but be aware of quoted fields containing commas – for that, consider using a CSV parsing package or a Regex pattern.
  • Remember that Split returns a new array – The original string remains unchanged. If you need to modify the original, assign the result back to a string variable after joining.

Troubleshooting

  • Error: “Overload resolution failed because no accessible ‘Split’ can be called with these arguments” – This usually means you passed a String instead of a Char. Ensure you add c after the delimiter literal, or use New Char() {...} for multiple delimiters.
  • Result array is empty or not what expected – Check the delimiter. If your string uses spaces but you split by comma, you’ll get one element. Use the Immediate Panel (Debug > Windows > Immediate) to inspect inputString and resultArray during debugging.
  • Split by newline yields extra empty lines – This happens because newline is often \r\n (two characters). Use Split(New String() {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) to clean it up.
  • Cannot assign to array variable – If you get a type mismatch, confirm that the variable type is String[] and not String or Object.
  • Split works in a test but not in a loop – If you’re splitting inside a For Each, remember that each iteration may have a different string. Ensure you’re reassigning the array each time, not accumulating.

Frequently Asked Questions

  • Can I split a string by a word (like “and”)? – Yes, but Split expects a Char or Char array. To split by a multi-character string, use inputString.Split(New String() {"and"}, StringSplitOptions.None).
  • How do I split a string into individual characters? – Use inputString.ToCharArray() to get a Char array, or convert to string array: inputString.Select(Function(c) c.ToString()).ToArray().
  • Is Split case-sensitive? – Yes, by default. If you need case-insensitive splitting, use Regex.Split with RegexOptions.IgnoreCase, e.g., Regex.Split(inputString, ",", RegexOptions.IgnoreCase).
  • Can I split a string from a CSV file directly? – Yes, read the file content into a string variable, then use Split. But for complex CSV with quoted commas, consider using a dedicated CSV parser like Microsoft.VisualBasic.FileIO.TextFieldParser.
  • What is the difference between Split and Substring? – Split divides a string into multiple parts based on a delimiter, returning an array. Substring extracts a single contiguous portion based on a start index and length.
  • How do I split a string by multiple different delimiters at once? – Pass a Char array to Split: inputString.Split(New Char() {","c, ";"c, "|"c}). This splits at any of those characters.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.