The number of digits after the point in the code that is in Notoped++
-
Hello.
I need to reduce the number of digits after the point in the code that is in Notoped++ . For example: in the code 3.6787687 need to be 3.67. Thanks. -
I might be looking at this the wrong way but if ALL numbers are to be altered then try this:
Find:(\d+.\d{1,2})\d*
Replace:\1So it doesn’t care how many digits to the left of the “.” as long as there is at least 1 (denoted by the “+”). Then it must have a “.” followed by as many digits as there are, however the first 2 are kept in the ‘saved string’ “\1” which is the replacement.
If you need to change the number of digits kept after the “.” change the numbers in the {}, i.e. {1,3}.
A quick test with a number like 1.2 still left it as 1.2, whereas a longer one was truncated back to 2 significant digits. This does NOT round, only truncates which your examples suggests what you want to achieve.Terry
-
My previous post had an error. I will blame fat fingers.
The Find string should be “(\d+.\d{1,2})\d*”. Grab the characters inside the "'s (don’t include the "). The error was with the “.”. As it has special significance in regex’s it needs the “” before it to say we actual want the “.”, not the character group it represents.Terry
-
@Terry-R
I can’t see any difference in your 2 expressions. Did you mean this?(\d+\.\d{1,2})\d*
-
What to put In the line “to replace” ?
-
\1
-
OK, so it’s not fat fingers it’s poor eyesight. i could swear that the “” was missing, now it’s back again. This time I’ll blame my monitor for rubbing out that character!
Terry
-
Thank you. It works.