6#ifndef _ZFI_ZFCoreStringUtil_h_
7#define _ZFI_ZFCoreStringUtil_h_
106 zfmemcpy(old + oldSize, append, size);
127 zfmemcpy(old + oldSize, append, size);
128 old[oldSize + size] =
'\0';
156 return (*s2 ==
'\0');
159 return (*s1 ==
'\0');
162 return (
zfscmp(s1, s2) == 0);
178 else if(!s1 || s1Len == 0) {
179 return (s2Len == 0 || *s2 ==
'\0');
182 return (s1Len == 0 || *s1 ==
'\0');
191 return (s1Len == s2Len &&
zfsncmp(s1, s2, s1Len) == 0);
198 return (s ==
zfnull || *s ==
'\0');
204 return (s ==
zfnull || *s ==
'\0' || len == 0);
547 for(
zfindex i = 0; i < count; ++i) {
548 ret.append(token, len);
582#define zfstringSwitch(v, c0, ...) _ZFP_zfstringSwitch(v, c0 \
583 ZFM_FIX_PARAM(_ZFP_zfstringSwitchExpand, ZFM_EMPTY, ##__VA_ARGS__) \
585#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:530
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:197
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:487
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:519
zfchar * zfsChange(zfchar *&dst, const zfchar *src)
util method to free old string then copy and change to new string, free and set dst to null if src is...
Definition ZFCoreStringUtil.h:52
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:148
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:504
void zfstringToUpperT(zfstring &ret)
to upper case
zfchar * zfsAppend(zfchar *&old, const zfchar *append)
util method to append string to existing string buffer, realloc if need
Definition ZFCoreStringUtil.h:94
zfstring zfstringRepeat(const zfchar *token, zfindex count)
repeat string
Definition ZFCoreStringUtil.h:553
zfstring zfstringReplace(const zfchar *src, const zfchar *replaceFrom, const zfchar *replaceTo, zfindex maxCount=((zfindex) -1), zfindex *replacedCount=zft_zfnull)
replace string
zfchar * zfsCopy(const zfchar *src)
util method to copy the contents of src, return null if src null, or empty string if src is empty str...
Definition ZFCoreStringUtil.h:19
void zfstringRepeatT(zfstring &ret, const zfchar *token, zfindex count)
repeat string
Definition ZFCoreStringUtil.h:540
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:192
#define zffree(ptr)
same as free defined for future use, do nothing if ptr is NULL
Definition ZFCoreTypeDef_ClassType.h:112
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:184
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:196
#define zfrealloc(oldPtr, newSize)
same as realloc defined for future use
Definition ZFCoreTypeDef_ClassType.h:106
void * zfmemcpy(void *dst, const void *src, zfindex size)
wrapper to memcpy
Definition ZFCoreTypeDef_ClassType.h:140
#define zfmalloc(size)
same as malloc defined for future use
Definition ZFCoreTypeDef_ClassType.h:100
_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:331