E
E
eLig2018-02-20 14:45:22
Regular Expressions
eLig, 2018-02-20 14:45:22

How to compose a regular expression to remove the last zero in a number if the number is with a dot?

Hello!
We have the following numbers:
900
900.00
900.90
Should be:
900
900
900.9
I can't make a regular expression.
All that could give birth: \.00+ or ​​\.\d{1,}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nick Sdk, 2018-02-20
@eLig

\.0+|(?<=\d\.[1-9])0+
only she will not haw like this:

900.990

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question