【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.2.64 str_end_char
Contents
Description
Get the last char of a string
Syntax
char str_end_char( LPCSTR lpcsz, int * nEndPos = NULL )
Parameters
- lpcsz
- [input] input string
- nEndPos
- [output] optional pointer to hold last character index, should be (length-1)
Return
-1 if the given string is empty, otherwise the last character
Examples
EX1
void str_end_char_ex1() { string str = "abcdefg"; int nEndPos; int nRet = str_end_char(str , &nEndPos); if( -1 == nRet ) printf("string is empty\n"); else printf("the end char is %c\nthe end position is %d\n", nRet, nEndPos); }
Remark
See Also
Header to Include
origin.h