Are strupr() and strlwr() in string.h part of the ANSI standard?

They are non-standard functions from Microsoft’s C library. MS has since deprecated them in favor of renamed functions _strlwr() and _strupr():

Note that the MS docs claim they are POSIX functions, but as far as I can tell they never have been.

If you need to use them on a non-MS toolchain, they’re easy enough to implement.

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

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

    return s;
}

Leave a Comment