J
Jon
I'm checking a character in a string for whitespace (spacebar or tab) or comment character (I use #
for this, signifying that anything following it is a comment so should be ignored). My C# code is:
string str=????
int ch=???? //character position in string
if(str[ch]==' ' || str[ch]=='\t' || str[ch]=='#'){
//delimiter found
????
}
It's what I've been using for many years (mainly in C - I've recently converted it to C#). It's
occurred to me that there might be problems with the above for non-English languages.
For instance, I know that in MS Word there are different types of spacebar (eg non-breaking space)
and also different lengths of spacebar (eg em-space, en-space). I wondered if these also exist in
Unicode, and if I should be checking for them. The same goes for tab and #.
If there are problems, how can I fix the above code?
for this, signifying that anything following it is a comment so should be ignored). My C# code is:
string str=????
int ch=???? //character position in string
if(str[ch]==' ' || str[ch]=='\t' || str[ch]=='#'){
//delimiter found
????
}
It's what I've been using for many years (mainly in C - I've recently converted it to C#). It's
occurred to me that there might be problems with the above for non-English languages.
For instance, I know that in MS Word there are different types of spacebar (eg non-breaking space)
and also different lengths of spacebar (eg em-space, en-space). I wondered if these also exist in
Unicode, and if I should be checking for them. The same goes for tab and #.
If there are problems, how can I fix the above code?