Do strupr () and strlwr () in string.h section have ANSI standard?

I searched this on the Internet and anywhere with string.h functions these two are not mentioned.

Because what? Are they not in every compiler?

+3
source share
3 answers

These are non-standard functions from the Microsoft C library. Since then, MS has abandoned them in favor of renamed functions _strlwr()and _strupr():

Note that MS docs claim to be POSIX features, but as far as I can tell, they have never been.

If you need to use them in a non-MS toolchain, they are quite simple to implement.

char* strlwr(char* s)
{
    char* tmp = s;

    for (;*tmp;++tmp) {
        *tmp = tolower((unsigned char) *tmp);
    }

    return s;
}
+10
source

These functions are not standard C functions. Thus, the implementation is determined whether they are supported or not.

+4

These functions are not standard, and in fact their signatures are broken / not used. You cannot draw a string in place as a whole, because the length may change when the case is displayed.

+1
source

Source: https://habr.com/ru/post/1693961/


All Articles