6#ifndef _ZFI_ZFCoreStringUtil_h_
7#define _ZFI_ZFCoreStringUtil_h_
44 return (
zfscmp(s1, s2) == 0);
60 else if(!s1 || s1Len == 0) {
61 return (s2Len == 0 || *s2 ==
'\0');
63 else if(!s2 || s2Len == 0) {
64 return (s1Len == 0 || *s1 ==
'\0');
73 return (s1Len == s2Len &&
zfsncmp(s1, s2, s1Len) == 0);
80 return (s ==
zfnull || *s ==
'\0');
86 return (s ==
zfnull || *s ==
'\0' || len == 0);
441 for(
zfindex i = 0; i < count; ++i) {
442 ret.append(token, len);
476#define zfstringSwitch(v, c0, ...) _ZFP_zfstringSwitch(v, c0 \
477 ZFM_FIX_PARAM(_ZFP_zfstringSwitchExpand, ZFM_EMPTY, ##__VA_ARGS__) \
479#define _ZFP_zfstringSwitchExpand(arg) , ((const zfchar *)(arg))
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
utilities for ZFFramework
zfstring zfstringToUpper(const zfchar *src, zfindex srcLen=((zfindex) -1))
to upper case
Definition ZFCoreStringUtil.h:424
zfindex zfstringFindFirstNotOf(const zfchar *src, zfindex srcLen, const zfchar *find, zfindex findLen=((zfindex) -1))
find string
zfbool zfstringBeginWith(const zfchar *src, zfindex srcLen, const zfchar *find, zfindex findLen=((zfindex) -1))
find string
void zfstringSplitIndexT(ZFCoreArray< ZFIndexRange > &ret, const zfchar *src, const zfchar *separator, zfbool keepEmpty=_ZFT_t_zffalse)
split string
void zfstringToLowerT(zfstring &ret)
to lower case
zfbool zfstringIsEmpty(const zfchar *s)
util to check whether string is empty (null or empty string)
Definition ZFCoreStringUtil.h:79
zfindex zfstringFindCaseInsensitiveReversely(const zfchar *src, zfindex srcLen, const zfchar *find, zfindex findLen=((zfindex) -1))
find string
zfindex zfstringFindReversely(const zfchar *src, zfindex srcLen, const zfchar *find, zfindex findLen=((zfindex) -1))
find string
zfindex zfstringFindLastNotOf(const zfchar *src, zfindex srcLen, const zfchar *find, zfindex findLen=((zfindex) -1))
find string
zfindex zfstringFindFirstOf(const zfchar *src, zfindex srcLen, const zfchar *find, zfindex findLen=((zfindex) -1))
find string
zfbool zfstringEndWith(const zfchar *src, zfindex srcLen, const zfchar *find, zfindex findLen=((zfindex) -1))
find string
zfindex zfstringFindCaseInsensitive(const zfchar *src, zfindex srcLen, const zfchar *find, zfindex findLen=((zfindex) -1))
find string
zfstring zfstringReplaceReversely(const zfchar *src, const zfchar *replaceFrom, const zfchar *replaceTo, zfindex maxCount=((zfindex) -1), zfindex *replacedCount=zft_zfnull)
replace string
zfindex zfstringFind(const zfchar *src, zfindex srcLen, const zfchar *find, zfindex findLen=((zfindex) -1))
find string
ZFCoreArray< zfstring > zfstringSplit(const zfchar *src, const zfchar *separator, zfbool keepEmpty=_ZFT_t_zffalse)
split string
Definition ZFCoreStringUtil.h:369
zfindex zfsCheckMatch(const zfchar **tokens, zfindex tokenCount, const zfchar *toCompare, zfindex toCompareLength=((zfindex) -1))
check whether the toCompare matches the tokens, return the index in tokens or zfindexMax() if not mat...
zfstring zfstringToLower(const zfchar *src, zfindex srcLen=((zfindex) -1))
to lower case
Definition ZFCoreStringUtil.h:407
zfbool zfstringIsEqual(const zfchar *s1, const zfchar *s2)
util to compare two c strings, while null is regarded as equal to empty string
Definition ZFCoreStringUtil.h:30
void zfstringSplitT(ZFCoreArray< zfstring > &ret, const zfchar *src, const zfchar *separator, zfbool keepEmpty=_ZFT_t_zffalse)
split string
ZFCoreArray< ZFIndexRange > zfstringSplitIndex(const zfchar *src, const zfchar *separator, zfbool keepEmpty=_ZFT_t_zffalse)
split string
Definition ZFCoreStringUtil.h:386
void zfstringToUpperT(zfstring &ret)
to upper case
zfstring zfstringRepeat(const zfchar *token, zfindex count)
repeat string
Definition ZFCoreStringUtil.h:447
zfstring zfstringReplace(const zfchar *src, const zfchar *replaceFrom, const zfchar *replaceTo, zfindex maxCount=((zfindex) -1), zfindex *replacedCount=zft_zfnull)
replace string
void zfstringRepeatT(zfstring &ret, const zfchar *token, zfindex count)
repeat string
Definition ZFCoreStringUtil.h:434
zfindex zfstringFindLastOf(const zfchar *src, zfindex srcLen, const zfchar *find, zfindex findLen=((zfindex) -1))
find string
zfindex zfslen(const zfchar *s)
strlen wrapper as zfchar type
Definition ZFCoreTypeDef_CharType.h:144
_ZFT_t_zfchar zfchar
char wrapper
Definition ZFCoreTypeDef_CharType.h:17
zfint zfsncmp(const zfchar *s1, const zfchar *s2, zfindex count)
strncmp wrapper as zfchar type
Definition ZFCoreTypeDef_CharType.h:158
zfint zfscmp(const zfchar *s1, const zfchar *s2)
strcmp wrapper as zfchar type
Definition ZFCoreTypeDef_CharType.h:152
#define ZF_OUT_OPT
dummy macro that shows the param used as optional output
Definition ZFCoreTypeDef_ClassType.h:203
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:191
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:195
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:207
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
#define zftrue
bool true type
Definition ZFCoreTypeDef_CoreType.h:107
#define zfindexMax()
(zfindex)-1, indicate a max index value, see zfindex
Definition ZFCoreTypeDef_CoreType.h:159
#define zffalse
bool false type
Definition ZFCoreTypeDef_CoreType.h:111
#define zfnull
same as NULL, defined for future use
Definition ZFCoreTypeDef_CoreType.h:88
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
light weight array
Definition ZFCoreArray.h:348