常用的字符串操作

// Format string
_vsntprintf_s/_vstprintf_s: Write formatted output using a pointer to a  list of arguments.
_sntprintf_s/_stprintf_s: Writes formatted data to a string.
_sntscanf_s/_stscanf_s: Reads formatted data of a specified length from a  string.

 

// Find string
_tcschr: Finds the first occurrence of c in  str.
_tcsrchr: Scan a string for the last occurrence  of a character.
_tcsstr: Return a pointer to the first occurrence  of a search string in a string.
_tcsspn: Returns the index of the first character in a string that does  not belong to a set of characters.
_tcsspnp_s: Returns a pointer to the first character in a given string that is not in another given string.
memchr: Finds characters in a buffer.

 

// Reverse
_tcsrev: Reverse characters of a string.

 

// string to digit
_tcstol: Convert strings to a long-integer value.
_tcstoul: Convert strings to an unsigned long-integer value.
_tcstod: Convert strings to a double-precision value.

 

// uppercase/lowercase
_tcsupr_s: Convert a string to uppercase.
_tcslwr_s: Convert a string to lowercase.


// Comparison
_tcsnicmp: Compares n bytes of two strings, ignoring case.
_tcsicmp: Perform a lowercase comparison of strings.
_tcscmp: Compare strings.
memcmp: Compare characters in two buffers.


// Copy
_tcsncpy_s: Copies n bytes of a string to a destination string.
_tcscpy_s(strcpy_s/_mbscpy_s/wcscpy_s): Copy a string.

// Appending
_tcscat/_tcsncat_s: Append characters to a string.

// Length
_tcslen(strlen/wcslen): strlen interprets  the string as a single-byte character string, so its return value is  always equal to the number of bytes, even if the string contains  multibyte characters. wcslen is a  wide-character version of strlen;

_tcsclen(_mbslen/wcslen): _mbslen,_mbslen_l, _mbstrlen and _mbstrlen_l return  the number of multibyte characters in a multibyte-character string but  they do not test for multibyte-character validity.

_tcsclen_l: _mbstrlen and _mbstrlen_l tests for multibyte-character  validity and recognizes multibyte-character sequencessetlocale,  _wsetlocale. If the string passed to _mbstrlen or_mbstrlen_l contain an  invalid multibyte character for the code page, it returns -1 and sets  errno to EILSEQ.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值