/*$
mlk in apdtool
Copyright (c) 2020 Azel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
$*/

#ifndef MLK_STRING_H
#define MLK_STRING_H

#ifdef __cplusplus
extern "C" {
#endif

int mIntToStr(char *buf,int32_t n);
int mIntToStr_dig(char *buf,int32_t n,int dig);
int mIntToStr_float(char *buf,int32_t n,int dig);
int mStrToInt_range(const char *str,int min,int max);

void mStringFreeArray_tonull(char **buf);
void mStringReplace(char *str,char from,char to);
void mStringReverse(char *str,int len);
char *mStringFindChar(const char *str,char ch);
int mStringCompare_tochar(const char *str1,const char *str2,char ch);
int mStringCompare_number(const char *str,const char *str2);
char *mStringDup_replace0(const char *str,char ch);

mlkbool mStringGetNextSplit(const char **pptop,const char **ppend,char ch);
int mStringGetLineCnt(const char *str);
char *mStringGetNextLine(char *str,mlkbool replace0);
int mStringGetNullSplitNum(const char *str);
int mStringGetSplitInt(const char *str,char ch,int *dst,int maxnum);
int mStringGetSplitTextIndex(const char *target,int len,const char *str,char ch,mlkbool iscase);

mlkbool mStringIsASCII(const char *str);
mlkbool mStringIsNum(const char *str);
void mStringUpper(char *str);
void mStringLower(char *str);
int mStringGetVariableSize(const char *str);

mlkbool mStringMatch(const char *str,const char *pattern,mlkbool iscase);
int mStringMatch_splitPatterns(const char *str,const char *patterns,char split,mlkbool iscase);

#ifdef __cplusplus
}
#endif

#endif
