String toupper?
Is there a toupper function in vc for string or do I have to use toupper on each character manually?
Downloads: ZeroOne Realm
I do not know of a VC function that does this for you. If you have a null terminated string, it shouldnt really add too much overhead to do each character separately:
|
void strupr(char *str)
{
for (; *str != ''\0''; str++)
if ((*str >= ''a'') && (*str <= ''z'')) *str += ''A''-''a'';
}
the original strupr returns a pointer to the new string, you could do it too
i just show you the idea
Arkon
[QSoft Systems]
{
for (; *str != ''\0''; str++)
if ((*str >= ''a'') && (*str <= ''z'')) *str += ''A''-''a'';
}
the original strupr returns a pointer to the new string, you could do it too
i just show you the idea
![](smile.gif)
Arkon
[QSoft Systems]
|
Cool huh? I think it might have been stoffel who showed me this...
Chris Brodie
Is the Text variable an MFC class or something? The thing is Ive tried to include stdafx in my game but it gave me loads of errors including one that says you cannot include stdafx with winmain.h so im trying to avoid MFC classes.
I have found a solution anyway, basically I needed to compare to string without being case sensitive, I used strcmp which gave me a non zero value if the strings were the same but had some letters in upper case, I found out that there was a function that compares two string without case checking called stricmp and it works and all is fine.
I have found a solution anyway, basically I needed to compare to string without being case sensitive, I used strcmp which gave me a non zero value if the strings were the same but had some letters in upper case, I found out that there was a function that compares two string without case checking called stricmp and it works and all is fine.
![](smile.gif)
Downloads: ZeroOne Realm
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement