Rohi2023
(Roseline Joy)
April 29, 2024, 10:26pm
1
I feel that this should be a relatively easy thing to do, but I am stumped. I have a date formatted as e.g. “29 Apr, 2024”. I need to remove the space after “,” to make it “29 Apr,2024”. How do I do this? TIA!
ppr
(Peter Preuss)
April 29, 2024, 10:38pm
2
Rohi2023:
29 Apr, 2024”
we can use the string replace method:
Assign Activity:
strCleansed =
YourStringVar.Replace(", ",",")
Or can use a regex
Rohi2023
(Roseline Joy)
April 29, 2024, 10:41pm
3
I tried this but the space is still there. Regex confuses me
Rohi2023
(Roseline Joy)
April 29, 2024, 10:43pm
4
My workaround was to split the string, then concatenate (with trim).
ppr
(Peter Preuss)
April 29, 2024, 10:49pm
5
have a look here:
done with:
Rohi2023:
Regex confuses me
This CheatSheet introduces the basic use of regex functions. With further examples also special cases are presented.
Introduction
From the namespace System.Text.RegularExpressions following methods are offered:
Regex.Match
Regex.Matches
Regex.isMatch
Regex.Replace
Regex.Split
A simple usage for example would look like this:
[grafik]
Recommendation:
add System.Text.RegularExpressions to the imports:
[grafik]
it allows to use the shortened statement, as the namespace part can be ommited…
not recommended, as we can handle more simple as shown above
1 Like
Rohi2023
(Roseline Joy)
April 29, 2024, 10:53pm
6
Thank you so much for your help. I’m not sure why the replace function isn’t given me the same result. I however, found another solution using the Modify Date activity and providing my own custom format. This way I didn’t need to manipulate the string at all.
Thanks again. I have bookmarked the regex cheatsheet!
ppr
(Peter Preuss)
April 29, 2024, 10:55pm
7
perfect so the topic can be closed by marking the solving post
Forum FAQ - How to mark a post as a solution
This document is part of our beginners guide .
This article will teach you how to properly mark a post as a solution.
We were closely following our last UiPath Forum feedback round! topic and carefully extracted all the bits of feedback that was provided. As such, we would like to tackle the topic of solutions on our Forum and how to properly use them.
When is the topic resolved?
The topic can be considered resolved when the topic author has found…
1 Like
system
(system)
Closed
May 2, 2024, 10:55pm
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.