How to manipulate a part of string: Split, Trim, Substring, Replace, Remove, Left, Right

I don’t know if I understood correctly.
Do you have a condition not to process a case >= 10.00, and your code still recognizes that 10 < 10.00 (and is not equal)?

In the condition I think you can try put 10 instead of 10.00, though in my tests there was no difference :smiley:


Split(BalancesListItem.ToString,"/")(0).ToString.ToLower.Trim.Contains("com") Or
Split(BalancesListItem.ToString,"/")(0).ToString.ToLower.Trim.Contains("self") Or

Ev. do the rounding down with the Math.Floor function: Math.Floor(dec_number)

I did such tests on all possible variants for Decimal and Double:

Hello @Adrian_Star

Please check the image of sample data in balance column that i am trying to convert in to decimal. For example my numbers will be $0.00, $2.47, $6.76 , $10.00 etc and also some numbers will be like ($0.00) , ($2.47) , ($6.57), ($10.00) in brackets . Like i said earlier i am extracting all these numbers in “downbalance” variable and comparing it with greater than or equal to 10( >=10) … That’s what i am trying to achieve and i showed you what my downbalance variable looks like in earlier thread

Okay, which is what I assumed. I just wonder how it happens that in your code 10 is less than 10, not equal.

You have code done that extracts these numbers and converts them, but for some reason the conversion is not successful.
When a human looks at this example, it is all clear. What does the robot see to make mistakes?

Have you checked what data the robot gets before each check? Do we have any starting point? What you’ve shown me so far is the fragment from which I can’t find the error in flow.

Maybe if you showed more, sent sample data (file) and part of your workflow with the code, I / us could track the problem.

I have used this expression you gave me.
System.Text.RegularExpressions.Regex.Match(BalancesListItem,"((?<=$)\b\d+.\d{1,2}\b|(?<=$)\b\d+\b)").Value and the result came was

input was $0.01 and output through your expression is = 0.00 . i don`t know why it came like 0.00 instead of 0.01

what changes i have to make in regex expression?

@utsav.patel - you have to escape the $ as $

This is what @Adrian_Star gave already where I can see the $…

As an alternate: you can try this pattern…

1 Like

@Adrian_Star , sorry i had no screenshots in my project folder and now luckily i got it from my test project folder.

Below is the raw image of Uielemet balanceListitem variable from which i am trying to evaluate further in downbalance variable.


and this the variables i have right now in my script>>>

BalancesListItem = BalancesListItem.Replace(")","").Replace("(","")
downbalance = Split(BalancesListItem,"$")(3) and
downbalance = Split(Downbalance,".")(0) +"."+ Split(Downbalance,".")(1).Substring(0,2)

and than i am comparing it to >=10 for completion of further data which is…

Split(BalancesListItem.ToString,"/")(0).ToString.ToLower.Trim.Contains(“com”) or Split(BalancesListItem.ToString,"/")(0).ToString.ToLower.Trim.Contains(“self”) or convert.ToDecimal(Downbalance)>=10.00

Overall the process is working fine with amounts like(10.00,1.68,2.00,5.68,4.00 etc) but today when bot saw amount of (648.68) bot didnt recognize it and failed and downbalance variable is working on to evaluate this amounts. what change should i make in the downbalance variables formula? also i have tried your regex expression and didnt work on this 648.68 amount

Check this updated one…where I have made $ symbol as an optional one…


1 Like

Thanks @prasath17 !!
can you write the formula here one more time if you dont mind.. and these will also work when there are brackets in element like ($648.68) ,($2.45) because my inputs will be different at several times i.e sometimes there will be brackets and sometimes they wont ($648.68) or $648.68.

@utsav.patel - I have already showed with and without brackets…



@prasath17 How you combine both these variables (with and without brackets) into one? I tried but didn`t worked. Also my variable is “donwbalance”

@utsav.patel - Please open up a new forum query on this topic. This post is meant for String Manipulation tutorial, so it always best practice to open a query for your specific case.

Please, what expression can I use to identify capital letters that are followed by a dash in my string?
I have a text like D-Sometext-1-17B and I want to modify this text such that

  1. any capital letter that is followed by a dash is changed to italics
  2. any number that is followed by a capital letter is changed to superscript
  3. any number that follows a capital letter is changed to subscript.

Hi @Emmy_O ,

Pattern to: a capital letter is before a dash:

[A-Z](?=-) Or [\p{Lu}](?=-)


Pattern to: a capital letter is after a dash:



Pattern to: any number that is before a capital letter:



Pattern to: any number that is after a capital letter:



1 Like

Thanks a myriad! This is so helpful.

Please, what UiPath activity are you using here?

Screen is from:

To test RegEx in UiPath I also use: .NET Regex Tester - Regex Storm

Ok. Thanks.