How to add a space in a string?

string = APRIL2023

My requirement is I want to add a space in between them i.e APRIL 2023

Hi @Kumar_Sahu_Sameer ,

Use the following expression

system.Text.RegularExpressions.Regex.Replace(“APRIL2022”,“(?=\d{4})”," ")




One of many ways.

"APRIL2023".Replace(Right("APRIL2023",4)," "+Right("APRIL2023",4))


1 Like

Please Refer Below xaml: (2.5 KB)

Hi @Kumar_Sahu_Sameer

To add a space between the month and year in the given string “APRIL2023” using UiPath, you can use the following steps:

  1. Assign the string “APRIL2023” to a variable, let’s say “str”.
  2. Use the “Substring” method to extract the first four characters (month) and the last four characters (year) from the string.
  3. Concatenate the extracted month and year with a space in between using the “+” operator.
  4. Assign the concatenated string to a new variable, let’s say “newStr”.

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