Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
change numeric value
#1
How can i replace this text, i know i have to use an int dont know how to add 1

bob10

then out to qm output box bob11

so then i can replace bob10 to bob11 in the edit box.
#2
Code:
Copy      Help
str BB="Bob"
int i

rep 10
,i+1
,out "%s%i" BB i

OR

Code:
Copy      Help
str tmp BB="Bob"
int i
i=10
tmp.formata("%s%i" BB i)
out tmp

OR

Code:
Copy      Help
int i
i=10
str tmp.formata("Bob%i" i)
out tmp
#3
thanks for the reply, i think i asked the question wrong way.

what i want to do, is if in my edit box i have bob10 i want to change it to bob11 and also if it reads out bob110 to change it to bob111

so what im asking for it to count up in ones,

bob01
bob02
bob03
bob04
bob05
bob06
bob07
bob08
bob09
bob10
bob11
bob12
bob13


etc

bob19
bob20
bob21

etc

bob99
bob100
bob101

of course i dont want all them to run at once. so depending on the number thats there when i start run it it will change it to the next number up. if its possible,

what im gona do is get the text using getwintext and grabing the info through the controls,
then setwintext with the new number added to it
#4
There maybe a better way of doing it but this works.

Code:
Copy      Help
int i
str tmp b s subject="Bob10"

findrx(subject "\d+" 0 0 s);;gets # from string
findrx(subject "[^0-9]+" 0 0 b);;gets word from string
i=val(s);i+1 ;; adds one
tmp.formata("%s%i" b i)
out tmp
#5
ty vm for help.
#6
i got to use the code that you kindly made, but im now running into this problem

bob010

doesnt change to bob011


is there anyway i can change the code, so it would work for that also,
#7
John Wrote:
Code:
Copy      Help
str BB="Bob"
int i

rep 10
,i+1
,out "%s%i" BB i

OR

Code:
Copy      Help
str tmp BB="Bob"
int i
i=10
tmp.formata("%s%i" BB i)
out tmp

OR

Code:
Copy      Help
int i
i=10
str tmp.formata("Bob%i" i)
out tmp

is there a quick way to populate a combobox, with the out results?


Forum Jump:


Users browsing this thread: 1 Guest(s)