Is there any equivalent to 'strupr' for Xcode (C++) in Mac?

I'm trying to use a code I found online for a bigger algorithm and Xcode doesn't support this function. I tried using the library curses.h (because conio.h is not defined in Xcode) but I couln't find an equivalent command.

Upvotes: 1

Views: 907

Answers (1)

Ari Singh
Ari Singh

Reputation: 1306

In Xcode there is no built-in function to uppercase a string, but you can easily write one like so:

std::string strToUpper(std::string str)
{
    std::transform(str.begin(), str.end(), str.begin(), ::toupper);

    return str;
}

Upvotes: 3

Related Questions