繁体   English   中英

Mac中的Xcode(C ++)有没有相同的'strupr'?

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

我正在尝试使用我在网上找到的代码来获得更大的算法,Xcode不支持此功能。 我尝试使用库curses.h(因为在Xcode中没有定义conio.h)但是我找不到相应的命令。

在Xcode中没有内置函数来大写字符串,但你可以轻松地编写一个如下:

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

    return str;
}

试试这样吧。

#include <boost/algorithm/string.hpp>
#include <string>

std::string str = "Hello World";

boost::to_upper(str);

std::string newstr = boost::to_upper_copy<std::string>("Hello World");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM