Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to remove the last digit?
#1
For example
125000 -> 125
55000 -> 55
34500000 -> 34500
182309000 -> 182309

I wanna get the above results
If the last 3 digits at the end are not 000, or if the value is 0
I want to ignore it.

I using commends a trim, left, right, remove, etc..
but I don't know

I want to know how to do it.
#2
It's not elegant, but you could do
Macro Macro2
Code:
Copy      Help
str number="55000"
str s
if s.right(number 3) = "000"
,int NumberLength = number.len - 3
,out s.left(number NumberLength)
#3
I solved problem. Big Grin

thank you so much. Big Grin
#4
Function Function9600
Code:
Copy      Help
str ss s results
s=
;125000
;55000
;2500
;34500000
;10000000000
;182309000
;990
foreach(ss s)
,if(findrx(ss ".*0{3}$" 0 1 results)>=0)  ;;finds numbers only that end in 3 zeros
,,results.replacerx("0{3}$" "") ;; removes the 3 zeros from the results of findrx
,,out results


Forum Jump:


Users browsing this thread: 4 Guest(s)