i have a String *25.00 - (12345) rayan PWD *58.00 - (54321) RS. 80 off @2.5 L *25.00 - (6789) metro PWD where “*25.00 - (12345) rayan PWD” “*58.00 - (54321) RS. 80 off @2.5 L” “25.00 - (6789) metro PWD" are three different substrings and i need to exclude the Substring that contains “RS.” in it. whereas from all other substrings i need to extract the numbers “25.00” which is after a "” and before “-” and them sum them up.
Hi @Daniyal , Is it possible to attach text file with the input string
Hi @Daniyal
If your string contains “” then try this -
strNumber = if({YourString}.contains(“RS.”),“”,System.Text.RegularExpressions.Regex.Match({YourString},“(?<="”)[\dA-Za-z\s.]+(?=-)").ToString.Trim)
Else if your string doesn’t contains “” then try this -
strNumber = if({YourString}.contains(“RS.”),“”,System.Text.RegularExpressions.Regex.Match({YourString},“^[\dA-Za-z\s.]+(?=-)”).ToString.Trim
Cheers
Sure. here you go
InputString.txt (87 Bytes)
@Dibyaprakash.Pradhan.042 this did not work
Please try this
varsum= Str.Split({"*"},StringSplitOptions.RemoveEmptyEntries).Where(function(x) Not x.Contains("RS.")).Select(function(x) cdbl(x.Split({"-"},Stringsplitoptions.None)(0).Trim)).Sum
Varsum is of double type
Cheers
Hi @Daniyal ,
Please find the attached workflow I have created as per your requirement.
SumUpSubString.zip (3.2 KB)
Code developed using latest community version.
Hope it helps. Cheers