I am working on my Japanese language library. I have a string stored that is '#hir su go i'. I need to be able to analyze each character in the string. I have a variable to define which character in the string I am currently reading: curchar. I want to be able to read any character in the string depending on what this variable is set at, so for now I am using:
[pre]mid(input,curchar,curchar)[/pre]
However, this always returns an empty string. I guess mid does not work with both values being the same? I thought about trying, as an alternative:
[pre]left(mid(input,curchar,curchar+1),1)[/pre]
But I am pretty sure this will cause a problem when I get to the end of the string, and curchar+1 does not exist.
Well, that didn't work either (returned a blank string). However, nesting right() within left() worked fine. Something's funky about that mid() function...
The third parameter of mid() isn't the end coordinate, it's the length of the string taken. So to take just the n-position char (starting at 0), you'd do mid(mystring, n, 1). Thus, a loop to run through each char of a string one at a time would be:
for (position = 0; position < len(mystring); position++)
{
curchar = mid(mystring, position, 1);
}
Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.