大家都用的什么函数库?
有哪位高手推荐一套windows linux通用的标准C++类库,或者C语言函数库啊~
23 个解决方案
#1
不喜欢用库。直接用TCHAR 数组
#2
#include <string.h>
处理char str[]
#include <string>
处理string
楼主用VC就用CString啊,怎么扯到linux了呢?你认为在Linux下面能够看得到VC吗?
处理char str[]
#include <string>
处理string
楼主用VC就用CString啊,怎么扯到linux了呢?你认为在Linux下面能够看得到VC吗?
#3
CString类本人觉得还是不错的,用熟了,用活了还真是很方便的。你可以用STL的string类。实在不行就自己写了,目前还没有其他的比较流行的字符串处理函数,不过自己平时多积累,把每次写的函数都保留下来,以后用时直接用就行了。积累多了就可以自己弄个库。
#4
stl::string
#5
CString是mfc的,有时候不大方便,字符串处理属于纯算法累的,和操作系统关系不大,按说应该有这种类库。
找到个stdstring类,还没尝试,不知道好用不。
都自己写太麻烦了,不是写不出,是真不值得花那个时间。
话说我连个split都没找到,难不成常用的都要重写一遍么。。。
一个是字符串处理,一个是类型转换,真是很讨厌。。。
找到个stdstring类,还没尝试,不知道好用不。
都自己写太麻烦了,不是写不出,是真不值得花那个时间。
话说我连个split都没找到,难不成常用的都要重写一遍么。。。
一个是字符串处理,一个是类型转换,真是很讨厌。。。
#6
如果不使用stl的话,就用CString吧。
#7
嫌功能不够就用脚本吧
url = "file:///" + "d:\\abc\\def\\ghi.txt".split("\\").join("/");就把Windows路径变成URL路径了
#8
控制台也可以用CString,ATL中有CString
#9
CString再不行,使用正则.
#10
TCHAR
CString
std::string
std::wstring
TEXT(), _T()
boost::regex
#11
我只用:
TCHAR下面的_tcscpy,_tcscat,...
CString下面的全部成员
_T(),写代码的习惯,任何字符串我都会加上这个
TCHAR下面的_tcscpy,_tcscat,...
CString下面的全部成员
_T(),写代码的习惯,任何字符串我都会加上这个
#12
一般情况下,处理字符串我用STL的string,当然,现在编码基本上都是Unicode,所以在用字符串的时候用其对应的Unicode版本wstring.
声明字符数组的时候一般是用的wchat_t, 比如 wchar_t szBuf[MAX_PATH] = { 0 };
处理字符(不是字符串类)时一般用安全字符串处理函数(带XXX_s的那些函数),如swprintf_s,printf_s等等
声明字符数组的时候一般是用的wchat_t, 比如 wchar_t szBuf[MAX_PATH] = { 0 };
处理字符(不是字符串类)时一般用安全字符串处理函数(带XXX_s的那些函数),如swprintf_s,printf_s等等
#13
CRT的,不愿意用CSTRING这种倒过好几次手的东西
_mbscoll, _mbsicoll, _mbsncoll, _mbsnicoll Compare two multibyte-character strings using multibyte code page information (_mbsicoll and _mbsnicoll are case-insensitive)
_mbsdec, _strdec, _wcsdec Move string pointer back one character
_mbsinc, _strinc, _wcsinc Advance string pointer by one character
_mbslen Get number of multibyte characters in multibyte-character string; dependent upon OEM code page
_mbsnbcat Append, at most, first n bytes of one multibyte-character string to another
_mbsnbcmp Compare first n bytes of two multibyte-character strings
_mbsnbcnt Return number of multibyte-character bytes within supplied character count
_mbsnbcpy Copy n bytes of string
_mbsnbicmp Compare n bytes of two multibyte-character strings, ignoring case
_mbsnbset Set first n bytes of multibyte-character string to specified character
_mbsnccnt Return number of multibyte characters within supplied byte count
_mbsnextc, _strnextc, _wcsnextc Find next character in string
_mbsninc. _strninc, _wcsninc Advance string pointer by n characters
_mbsspnp, _strspnp, _wcsspnp Return pointer to first character in given string that is not in another given string
_mbstrlen Get number of multibyte characters in multibyte-character string; locale-dependent
_scprintf, _scwprintf Return the number of characters in a formatted string
_snscanf, _snwscanf Read formatted data of a specified length from the standard input stream.
sprintf, _stprintf Write formatted data to a string
strcat, wcscat, _mbscat Append one string to another
strchr, wcschr, _mbschr Find first occurrence of specified character in string
strcmp, wcscmp, _mbscmp Compare two strings
strcoll, wcscoll, _stricoll, _wcsicoll, _strncoll, _wcsncoll, _strnicoll, _wcsnicoll Compare two strings using current locale code page information (_stricoll, _wcsicoll, _strnicoll, and _wcsnicoll are case-insensitive)
strcpy, wcscpy, _mbscpy Copy one string to another
strcspn, wcscspn, _mbscspn, Find first occurrence of character from specified character set in string
_strdup, _wcsdup, _mbsdup Duplicate string
strerror, _wcserror Map error number to message string
_strerror, __wcserror Map user-defined error message to string
strftime, wcsftime Format date-and-time string
_stricmp, _wcsicmp, _mbsicmp Compare two strings without regard to case
strlen, wcslen, _mbslen, _mbstrlen Find length of string
_strlwr, _wcslwr, _mbslwr Convert string to lowercase
strncat, wcsncat, _mbsncat Append characters of string
strncmp, wcsncmp, _mbsncmp Compare characters of two strings
strncpy, wcsncpy, _mbsncpy Copy characters of one string to another
_strnicmp, _wcsnicmp, _mbsnicmp Compare characters of two strings without regard to case
_strnset, _wcsnset, _mbsnset Set first n characters of string to specified character
strpbrk, wcspbrk, _mbspbrk Find first occurrence of character from one string in another string
strrchr, wcsrchr,_mbsrchr Find last occurrence of given character in string
_strrev, _wcsrev,_mbsrev Reverse string
_strset, _wcsset, _mbsset Set all characters of string to specified character
strspn, wcsspn, _mbsspn Find first substring from one string in another string
strstr, wcsstr, _mbsstr Find first occurrence of specified string in another string
strtok, wcstok, _mbstok Find next token in string
_strupr, _wcsupr, _mbsupr Convert string to uppercase
strxfrm, wcsxfrm Transform string into collated form based on locale-specific information
vsprintf, _vstprint Write formatted output using a pointer to a list of arguments
_mbscoll, _mbsicoll, _mbsncoll, _mbsnicoll Compare two multibyte-character strings using multibyte code page information (_mbsicoll and _mbsnicoll are case-insensitive)
_mbsdec, _strdec, _wcsdec Move string pointer back one character
_mbsinc, _strinc, _wcsinc Advance string pointer by one character
_mbslen Get number of multibyte characters in multibyte-character string; dependent upon OEM code page
_mbsnbcat Append, at most, first n bytes of one multibyte-character string to another
_mbsnbcmp Compare first n bytes of two multibyte-character strings
_mbsnbcnt Return number of multibyte-character bytes within supplied character count
_mbsnbcpy Copy n bytes of string
_mbsnbicmp Compare n bytes of two multibyte-character strings, ignoring case
_mbsnbset Set first n bytes of multibyte-character string to specified character
_mbsnccnt Return number of multibyte characters within supplied byte count
_mbsnextc, _strnextc, _wcsnextc Find next character in string
_mbsninc. _strninc, _wcsninc Advance string pointer by n characters
_mbsspnp, _strspnp, _wcsspnp Return pointer to first character in given string that is not in another given string
_mbstrlen Get number of multibyte characters in multibyte-character string; locale-dependent
_scprintf, _scwprintf Return the number of characters in a formatted string
_snscanf, _snwscanf Read formatted data of a specified length from the standard input stream.
sprintf, _stprintf Write formatted data to a string
strcat, wcscat, _mbscat Append one string to another
strchr, wcschr, _mbschr Find first occurrence of specified character in string
strcmp, wcscmp, _mbscmp Compare two strings
strcoll, wcscoll, _stricoll, _wcsicoll, _strncoll, _wcsncoll, _strnicoll, _wcsnicoll Compare two strings using current locale code page information (_stricoll, _wcsicoll, _strnicoll, and _wcsnicoll are case-insensitive)
strcpy, wcscpy, _mbscpy Copy one string to another
strcspn, wcscspn, _mbscspn, Find first occurrence of character from specified character set in string
_strdup, _wcsdup, _mbsdup Duplicate string
strerror, _wcserror Map error number to message string
_strerror, __wcserror Map user-defined error message to string
strftime, wcsftime Format date-and-time string
_stricmp, _wcsicmp, _mbsicmp Compare two strings without regard to case
strlen, wcslen, _mbslen, _mbstrlen Find length of string
_strlwr, _wcslwr, _mbslwr Convert string to lowercase
strncat, wcsncat, _mbsncat Append characters of string
strncmp, wcsncmp, _mbsncmp Compare characters of two strings
strncpy, wcsncpy, _mbsncpy Copy characters of one string to another
_strnicmp, _wcsnicmp, _mbsnicmp Compare characters of two strings without regard to case
_strnset, _wcsnset, _mbsnset Set first n characters of string to specified character
strpbrk, wcspbrk, _mbspbrk Find first occurrence of character from one string in another string
strrchr, wcsrchr,_mbsrchr Find last occurrence of given character in string
_strrev, _wcsrev,_mbsrev Reverse string
_strset, _wcsset, _mbsset Set all characters of string to specified character
strspn, wcsspn, _mbsspn Find first substring from one string in another string
strstr, wcsstr, _mbsstr Find first occurrence of specified string in another string
strtok, wcstok, _mbstok Find next token in string
_strupr, _wcsupr, _mbsupr Convert string to uppercase
strxfrm, wcsxfrm Transform string into collated form based on locale-specific information
vsprintf, _vstprint Write formatted output using a pointer to a list of arguments
#14
还是用Stl中的String吧,这样可扩展性好。如果只在Vc环境下可以考虑Cstring
#15
VC CString
#16
用CString就行了啊
#17
CString 或string
#18
std::string
#19
对比了一下,最终决定还是用std::wstring。
看了一下ostringstream好像挺好用。
为什么这么多人都不用?
用着两套东西有什么需要注意的吗?比如用这个wstring在windows平台会不会容易发生什么错误之类的。
又或者双字节的wstring有什么情况不如用string好一些?
看了一下ostringstream好像挺好用。
为什么这么多人都不用?
用着两套东西有什么需要注意的吗?比如用这个wstring在windows平台会不会容易发生什么错误之类的。
又或者双字节的wstring有什么情况不如用string好一些?
#20
CString类已经很好用了
#21
通用的貌似是比较困难,总有不同
要是打算代码跨平台,还非得用C,要么自己注意些,比如strcpy_s这种linux下没有
要么,用ACE之类的吧
要是打算代码跨平台,还非得用C,要么自己注意些,比如strcpy_s这种linux下没有
要么,用ACE之类的吧
#22
。
#23
俺经常用Cstring !!
#1
不喜欢用库。直接用TCHAR 数组
#2
#include <string.h>
处理char str[]
#include <string>
处理string
楼主用VC就用CString啊,怎么扯到linux了呢?你认为在Linux下面能够看得到VC吗?
处理char str[]
#include <string>
处理string
楼主用VC就用CString啊,怎么扯到linux了呢?你认为在Linux下面能够看得到VC吗?
#3
CString类本人觉得还是不错的,用熟了,用活了还真是很方便的。你可以用STL的string类。实在不行就自己写了,目前还没有其他的比较流行的字符串处理函数,不过自己平时多积累,把每次写的函数都保留下来,以后用时直接用就行了。积累多了就可以自己弄个库。
#4
stl::string
#5
CString是mfc的,有时候不大方便,字符串处理属于纯算法累的,和操作系统关系不大,按说应该有这种类库。
找到个stdstring类,还没尝试,不知道好用不。
都自己写太麻烦了,不是写不出,是真不值得花那个时间。
话说我连个split都没找到,难不成常用的都要重写一遍么。。。
一个是字符串处理,一个是类型转换,真是很讨厌。。。
找到个stdstring类,还没尝试,不知道好用不。
都自己写太麻烦了,不是写不出,是真不值得花那个时间。
话说我连个split都没找到,难不成常用的都要重写一遍么。。。
一个是字符串处理,一个是类型转换,真是很讨厌。。。
#6
如果不使用stl的话,就用CString吧。
#7
嫌功能不够就用脚本吧
url = "file:///" + "d:\\abc\\def\\ghi.txt".split("\\").join("/");就把Windows路径变成URL路径了
#8
控制台也可以用CString,ATL中有CString
#9
CString再不行,使用正则.
#10
TCHAR
CString
std::string
std::wstring
TEXT(), _T()
boost::regex
#11
我只用:
TCHAR下面的_tcscpy,_tcscat,...
CString下面的全部成员
_T(),写代码的习惯,任何字符串我都会加上这个
TCHAR下面的_tcscpy,_tcscat,...
CString下面的全部成员
_T(),写代码的习惯,任何字符串我都会加上这个
#12
一般情况下,处理字符串我用STL的string,当然,现在编码基本上都是Unicode,所以在用字符串的时候用其对应的Unicode版本wstring.
声明字符数组的时候一般是用的wchat_t, 比如 wchar_t szBuf[MAX_PATH] = { 0 };
处理字符(不是字符串类)时一般用安全字符串处理函数(带XXX_s的那些函数),如swprintf_s,printf_s等等
声明字符数组的时候一般是用的wchat_t, 比如 wchar_t szBuf[MAX_PATH] = { 0 };
处理字符(不是字符串类)时一般用安全字符串处理函数(带XXX_s的那些函数),如swprintf_s,printf_s等等
#13
CRT的,不愿意用CSTRING这种倒过好几次手的东西
_mbscoll, _mbsicoll, _mbsncoll, _mbsnicoll Compare two multibyte-character strings using multibyte code page information (_mbsicoll and _mbsnicoll are case-insensitive)
_mbsdec, _strdec, _wcsdec Move string pointer back one character
_mbsinc, _strinc, _wcsinc Advance string pointer by one character
_mbslen Get number of multibyte characters in multibyte-character string; dependent upon OEM code page
_mbsnbcat Append, at most, first n bytes of one multibyte-character string to another
_mbsnbcmp Compare first n bytes of two multibyte-character strings
_mbsnbcnt Return number of multibyte-character bytes within supplied character count
_mbsnbcpy Copy n bytes of string
_mbsnbicmp Compare n bytes of two multibyte-character strings, ignoring case
_mbsnbset Set first n bytes of multibyte-character string to specified character
_mbsnccnt Return number of multibyte characters within supplied byte count
_mbsnextc, _strnextc, _wcsnextc Find next character in string
_mbsninc. _strninc, _wcsninc Advance string pointer by n characters
_mbsspnp, _strspnp, _wcsspnp Return pointer to first character in given string that is not in another given string
_mbstrlen Get number of multibyte characters in multibyte-character string; locale-dependent
_scprintf, _scwprintf Return the number of characters in a formatted string
_snscanf, _snwscanf Read formatted data of a specified length from the standard input stream.
sprintf, _stprintf Write formatted data to a string
strcat, wcscat, _mbscat Append one string to another
strchr, wcschr, _mbschr Find first occurrence of specified character in string
strcmp, wcscmp, _mbscmp Compare two strings
strcoll, wcscoll, _stricoll, _wcsicoll, _strncoll, _wcsncoll, _strnicoll, _wcsnicoll Compare two strings using current locale code page information (_stricoll, _wcsicoll, _strnicoll, and _wcsnicoll are case-insensitive)
strcpy, wcscpy, _mbscpy Copy one string to another
strcspn, wcscspn, _mbscspn, Find first occurrence of character from specified character set in string
_strdup, _wcsdup, _mbsdup Duplicate string
strerror, _wcserror Map error number to message string
_strerror, __wcserror Map user-defined error message to string
strftime, wcsftime Format date-and-time string
_stricmp, _wcsicmp, _mbsicmp Compare two strings without regard to case
strlen, wcslen, _mbslen, _mbstrlen Find length of string
_strlwr, _wcslwr, _mbslwr Convert string to lowercase
strncat, wcsncat, _mbsncat Append characters of string
strncmp, wcsncmp, _mbsncmp Compare characters of two strings
strncpy, wcsncpy, _mbsncpy Copy characters of one string to another
_strnicmp, _wcsnicmp, _mbsnicmp Compare characters of two strings without regard to case
_strnset, _wcsnset, _mbsnset Set first n characters of string to specified character
strpbrk, wcspbrk, _mbspbrk Find first occurrence of character from one string in another string
strrchr, wcsrchr,_mbsrchr Find last occurrence of given character in string
_strrev, _wcsrev,_mbsrev Reverse string
_strset, _wcsset, _mbsset Set all characters of string to specified character
strspn, wcsspn, _mbsspn Find first substring from one string in another string
strstr, wcsstr, _mbsstr Find first occurrence of specified string in another string
strtok, wcstok, _mbstok Find next token in string
_strupr, _wcsupr, _mbsupr Convert string to uppercase
strxfrm, wcsxfrm Transform string into collated form based on locale-specific information
vsprintf, _vstprint Write formatted output using a pointer to a list of arguments
_mbscoll, _mbsicoll, _mbsncoll, _mbsnicoll Compare two multibyte-character strings using multibyte code page information (_mbsicoll and _mbsnicoll are case-insensitive)
_mbsdec, _strdec, _wcsdec Move string pointer back one character
_mbsinc, _strinc, _wcsinc Advance string pointer by one character
_mbslen Get number of multibyte characters in multibyte-character string; dependent upon OEM code page
_mbsnbcat Append, at most, first n bytes of one multibyte-character string to another
_mbsnbcmp Compare first n bytes of two multibyte-character strings
_mbsnbcnt Return number of multibyte-character bytes within supplied character count
_mbsnbcpy Copy n bytes of string
_mbsnbicmp Compare n bytes of two multibyte-character strings, ignoring case
_mbsnbset Set first n bytes of multibyte-character string to specified character
_mbsnccnt Return number of multibyte characters within supplied byte count
_mbsnextc, _strnextc, _wcsnextc Find next character in string
_mbsninc. _strninc, _wcsninc Advance string pointer by n characters
_mbsspnp, _strspnp, _wcsspnp Return pointer to first character in given string that is not in another given string
_mbstrlen Get number of multibyte characters in multibyte-character string; locale-dependent
_scprintf, _scwprintf Return the number of characters in a formatted string
_snscanf, _snwscanf Read formatted data of a specified length from the standard input stream.
sprintf, _stprintf Write formatted data to a string
strcat, wcscat, _mbscat Append one string to another
strchr, wcschr, _mbschr Find first occurrence of specified character in string
strcmp, wcscmp, _mbscmp Compare two strings
strcoll, wcscoll, _stricoll, _wcsicoll, _strncoll, _wcsncoll, _strnicoll, _wcsnicoll Compare two strings using current locale code page information (_stricoll, _wcsicoll, _strnicoll, and _wcsnicoll are case-insensitive)
strcpy, wcscpy, _mbscpy Copy one string to another
strcspn, wcscspn, _mbscspn, Find first occurrence of character from specified character set in string
_strdup, _wcsdup, _mbsdup Duplicate string
strerror, _wcserror Map error number to message string
_strerror, __wcserror Map user-defined error message to string
strftime, wcsftime Format date-and-time string
_stricmp, _wcsicmp, _mbsicmp Compare two strings without regard to case
strlen, wcslen, _mbslen, _mbstrlen Find length of string
_strlwr, _wcslwr, _mbslwr Convert string to lowercase
strncat, wcsncat, _mbsncat Append characters of string
strncmp, wcsncmp, _mbsncmp Compare characters of two strings
strncpy, wcsncpy, _mbsncpy Copy characters of one string to another
_strnicmp, _wcsnicmp, _mbsnicmp Compare characters of two strings without regard to case
_strnset, _wcsnset, _mbsnset Set first n characters of string to specified character
strpbrk, wcspbrk, _mbspbrk Find first occurrence of character from one string in another string
strrchr, wcsrchr,_mbsrchr Find last occurrence of given character in string
_strrev, _wcsrev,_mbsrev Reverse string
_strset, _wcsset, _mbsset Set all characters of string to specified character
strspn, wcsspn, _mbsspn Find first substring from one string in another string
strstr, wcsstr, _mbsstr Find first occurrence of specified string in another string
strtok, wcstok, _mbstok Find next token in string
_strupr, _wcsupr, _mbsupr Convert string to uppercase
strxfrm, wcsxfrm Transform string into collated form based on locale-specific information
vsprintf, _vstprint Write formatted output using a pointer to a list of arguments
#14
还是用Stl中的String吧,这样可扩展性好。如果只在Vc环境下可以考虑Cstring
#15
VC CString
#16
用CString就行了啊
#17
CString 或string
#18
std::string
#19
对比了一下,最终决定还是用std::wstring。
看了一下ostringstream好像挺好用。
为什么这么多人都不用?
用着两套东西有什么需要注意的吗?比如用这个wstring在windows平台会不会容易发生什么错误之类的。
又或者双字节的wstring有什么情况不如用string好一些?
看了一下ostringstream好像挺好用。
为什么这么多人都不用?
用着两套东西有什么需要注意的吗?比如用这个wstring在windows平台会不会容易发生什么错误之类的。
又或者双字节的wstring有什么情况不如用string好一些?
#20
CString类已经很好用了
#21
通用的貌似是比较困难,总有不同
要是打算代码跨平台,还非得用C,要么自己注意些,比如strcpy_s这种linux下没有
要么,用ACE之类的吧
要是打算代码跨平台,还非得用C,要么自己注意些,比如strcpy_s这种linux下没有
要么,用ACE之类的吧
#22
。
#23
俺经常用Cstring !!