finding the value of a position in text

I’m having a problem with text. In the past I was shown how to count the text which was of value and appreciated. What I am trying to do is also determine the value of the text in a specific position. For example, I have a string “The fox is in the woods.” I now know how to determine that the f in fox is the fifth (5) space. What I’d like to know is where I can find out how to assign the letter f to a variable so that I know both the letter (in this case the f) and the position.

Say I have a card game and use A,K,Q, J for cards. I use shuffle to position the cards. I get Q K J A. I need the program to read that the first position has a Q (queen), the second has a K (king) and so on. For some reason I cannot find the answer to this problem in the Forum or in any texts. Any help would be appreciated. Thank you.

Maybe http://documentation.xojo.com/index.php/Instr

From your previous thread

[quote=208919:@Tim Hare]Given:
dim s as string = “The fox was in the meadow.”

c = mid(s,5,1)[/quote]

I must be doing something wrong as I used the above code, c = mid(s,5,1) and have been getting the integer for the position rather than the letter itself. I get an answer of 5 which is correct, but I’m unable to determine the letter as being an ‘f’. Would you be able to tell me why I can’t get the letter value?

Thanks to both Tim and Michel for your help.

James,

The Xojo Mid Function returns a STRING value and not an integer. If you are using the above code snippet and are receiving 5 then either you are getting a string “5” or you are not using mid?

http://documentation.xojo.com/index.php/Mid

Let us know.

thanks! Mike

Posting your actual code is always helpful.

Thank you Tim, Michel, Mike and Kem.

Everything is working correctly. Made a rookie error in that I had text coming from a text box when in fact text was in a text area. Changed txtOM.text to taOM.text and success. I appreciate your help.