extract last three character of a string

I have a text wave each point of the wave is a string that is of different lengths. The last three character of the string is of use to me and I want to extract the last three characters. I also want to use a if-statement on the second to last character--if this character is a dash line or not, so I would also like to parse out this character as well. What I can think of is counting the number of characters in the string using strlen and do maths. Is there a better way to do these kind of tasks?
That sounds like a good approach. Can you get it to work?

Depending on the format of the string you can look at SplitString to parse out different elements of the string. If the strings are all of a certain format this works well. Other people on the forum will have alternative solutions to this problem.
StrLen sounds like a good way of doing it. You could also look at Extract and Grep. Grep is really powerful for selecting strings matching certain criteria, but the regular expressions needed are not easy to understand. Just as an example, this is a Grep command I use to find the positions of lines with the format [..something..] in a loaded text file Grep/INDX/E="(^\\[)(.+)(\\]$)" LoadedTextWave as TempGrepWave
An example to pull characters from a string

variable twlen = strlen(tstring)
string chars = tstring[twlen-4,]
string tchar = chars[0]
strswitch tchar
...
end switch


--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
Thank you very much guys! I was able to get the strlen to work like jjweimer has shown. Splitstring, extract and grep look really powerful too. It does take some efforts to understand grep though. I am still figuring it out. Thank you all!
mwpro wrote:
... Splitstring, extract and grep look really powerful too. It does take some efforts to understand grep though. I am still figuring it out. Thank you all!


Grep (and its invocations with splitstring or extract) is useful to pull out portions of strings that follow patterns. Think of searching for tags in HTML < ... > or brackets [ ... ] or other demarkations that denote boundaries of words or contents. To pull out portions of strings according to position in the string, the better approach is to use index notations as demonstrated.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH