How about doing it this way:
PRINT pigLatinString("Hellow my name is james")
WAIT KEY
function pigLatinString(inString AS STRING)
LOCAL aWord AS STRING
LOCAL outString AS STRING
aWord=FIRST TOKEN$(inString," ")
outString=""
while aWord<>""
outString=outString + reverseString(aWord) + "ay "
aWord=next TOKEN$(" ")
endwhile
endfunction outString
function reverseString(inString AS STRING)
LOCAL lth AS INTEGER
LOCAL lp AS INTEGER
LOCAL outString AS STRING
outString=""
lth=LEN(inString)
for lp=lth TO 1 STEP -1
outString=outString + MID$(inString,lp)
next lp
endfunction outString
Using TOKEN$ functions and also splitting it into two functions to make it easier, first one to reverse a word, the second one to go through all the words and add "ay " to the end of each one.
Hope this helps.
Jas
----
"What is this talk of 'release'? Klingons do not'release' software. It escapes leaving a bloody trail of developers and quality assurance people in its wake!"