Hi Bernd and Bangkok,
Thanks to you both for responding to my post. The reason for my initial question about counterparts in Rev for the VB left$, mid$ and right$ functions was because a friend asked me if I knew Rev well enough to translate the following VB code into Rev.
text1.text = 12345
dim i as integer
dim ctr as string
for i = len(text1.text) to 1 step -1
ctr = ctr + mid(text1.text,i,1)
next i
text2.text = ctr
print text1.texta
print ctr
I don’t know if you know what this does, so I’ll show the display:
12345
54321
Here’s my rendition of the above VB code in Rev:
Code: Select all
on mouseUp --displays text backwards
put "Bill Gates" into name1
put name1 into fld "l1"
repeat with i =1 to len(name1)
wait 200 milliseconds
get the char(i) of name1
put it before fld "l2"
end repeat
end mouseUp
Display:
Bill Gates
setaG lliB
It’s been awhile since I dabbled in VB so I had to look up what the VB functions do:
Left$() Returns the left n characters of a string; temp = left$ ( teststring$, 4 )
Right - Returns the right n characters of a string; temp = right$ ( teststring$, 4 )
Mid - Returns n characters from a string, starting a any position; temp = mid$ ( teststring$, 1, 4 )
So, below are my translations of the VB functions, with thanks to both of you for your suggestions:
Code: Select all
on mouseUp --like VB left$ function
put "Bill Gates" into name1
put name1 into fld "l1"
put char 1 to 4 name1 into fld "l2"
put char 1 to 7 name1 into fld "l3"
put char 1 to 2 name1 into fld “l4”
End mouseUp
Display:
Bill Gates
Bill
Bill Ga
Bi
--
Code: Select all
on mouseUp --like VB right$ function
put "Bill Gates" into name1
put name1 into fld "l1"
put char 4 to -1 of name1 into fld "l2"
put char -2 to -1 of name1 into fld "l3"
put char 7 to -1 of name1 into Field "l4"
end mouseUp
Display:
Bill Gates
l Gates
Es
ates
--
Code: Select all
on mouseUp --like VB mid$ function
put "Bill Gates" into name1
put name1 into fld "l1"
put char 1 to 4 of name1 into fld "l2"
put char 6 to 7 of name1 into fld "l3"
put middle char of name1 into Field "l4"
end mouseUp
Display:
Bill Gates
Bill
Ga
G
Oh, and by the way, since I have your attention, I have a question. As you know, when using a slider, you can set the values to be shown at the bottom of the slider in the properties of the slider. Is there a way to show those values in a text or label field? So, as the slider is moved, is it possible to show the changing values in a field, label or text?
Again, thanks to both of you for your help.
Dan