Hi All,
I need to remove any zeroes after any integer digit after decimal.
for example if my value is $0.04500 USD, it should consider 0.045,
if the value is $0.698250 USD it should consider as 0.69825 only
and also remove $ , SPACE AND USD VALUE .
For example $0.69825 USD should be 0.69825 only. Can I achieve this in single expression?
@Anil_G
Basically my actual value in Queue is 1.400000 . When it gets updated in application its becomes $1.40 USD
I have to compare and see its the same value . If its zero it should consider only one zero after any integer digit after decimal
For example
Make 1.400000 as 1.40 and $1.40 USD as 1.40
Similarly 1.00000 as 1.00 and $1.00 USD as 1.00
Similarly $0.0405 USD as 0.0405 and 0.040500 as 0.0405
If there multiple zeroes after integer it should consider 1.40(only one zero after integer digit) and remove $ and USD Sign
UI_Michael
(Michael Scheel)
December 7, 2024, 12:24pm
4
Hi whats about split and replace options?
Ex1: [quote=βdutta.marina, post:3, topic:784225β]
Make 1.400000 as 1.40 [/quote]
strPart1 = yourString.Split(".βc)(0)
strPart2 = yourString.Split(β."c)(1)
strFinal = strPart1 + β.β + strPart2.substring(0,2)
Ex2: [quote=βdutta.marina, post:3, topic:784225β]
$1.40 USD as 1.40
[/quote]
yourString = yourString.Replace(β$β,ββ)
yourString = yourString.Replace(βUSDβ,ββ).Trim
If you need doubleValues you can use Convert.toDouble(yourString)
Cheers!
Anil_G
(Anil Gorthi)
December 7, 2024, 2:11pm
5
@dutta.marina
Please try this
\d+\.\d{2}\d*(?<=[1-9])|\d+\.\d{2}
Cheers
1 Like
system
(system)
Closed
December 13, 2024, 2:03pm
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.