CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
strmanip.h
1#pragma once
2
4#include <cx/string/strbase.h>
5
6CX_C_BEGIN
7
9enum STRING_SPECIAL {
10 strEnd = 0x7fffffff
11};
12
58
78bool strAppend(_Inout_ strhandle io, _In_opt_ strref s);
79
102bool strAppendBytes(_Inout_ strhandle io, _In_reads_bytes_opt_(sz) const void* _Nullable buf,
103 uint32 sz);
104
124void strAppendChar(_Inout_ strhandle io, uint8 ch);
125
142bool strPrepend(_In_opt_ strref s, _Inout_ strhandle io);
143
166bool strRepeat(_Inout_ strhandle o, _In_opt_ strref s, uint32 n);
167
185bool strFillChar(_Inout_ strhandle o, uint8 ch, uint32 n);
186
206bool strConcat(_Inout_ strhandle o, _In_opt_ strref s1, _In_opt_ strref s2);
207
228bool strConcatC(_Inout_ strhandle o, _Inout_ strhandle sc1, _Inout_ strhandle sc2);
229
250#define strNConcat(o, ...) _strNConcat(o, count_macro_args(__VA_ARGS__), (strref[]) { __VA_ARGS__ })
251bool _strNConcat(_Inout_ strhandle o, int n, _In_ strref* _Nonnull stra);
252
277#define strNConcatC(o, ...) \
278 _strNConcatC(o, count_macro_args(__VA_ARGS__), (string*[]) { __VA_ARGS__ })
279bool _strNConcatC(_Inout_ strhandle o, int n, _Inout_ strhandle* _Nonnull stra);
280
303bool strSubStr(_Inout_ strhandle o, _In_opt_ strref s, int32 b, int32 e);
304
324bool strSubStrC(_Inout_ strhandle o, _Inout_ strhandle sc, int32 b, int32 e);
325
343bool strSubStrI(_Inout_ strhandle io, int32 b, int32 e);
344
372bool strTrim(_Inout_ strhandle o, _In_opt_ strref s, _In_opt_ strref chars);
373
389bool strLTrim(_Inout_ strhandle o, _In_opt_ strref s, _In_opt_ strref chars);
390
406bool strRTrim(_Inout_ strhandle o, _In_opt_ strref s, _In_opt_ strref chars);
407
436bool strReplaceChar(_Inout_ strhandle o, _In_opt_ strref s, char from, char to);
437
456bool strReplaceChari(_Inout_ strhandle o, _In_opt_ strref s, char from, char to);
457
483bool strReplace(_Inout_ strhandle o, _In_opt_ strref s, _In_opt_ strref find, _In_opt_ strref repl,
484 int32 max);
485
503bool strReplacei(_Inout_ strhandle o, _In_opt_ strref s, _In_opt_ strref find, _In_opt_ strref repl,
504 int32 max);
505
529bool strInsert(_Inout_ strhandle o, _In_opt_ strref s, int32 off, _In_opt_ strref ins);
530
553bool strErase(_Inout_ strhandle o, _In_opt_ strref s, int32 b, int32 e);
554
572void strUpper(_Inout_ strhandle io);
573
591void strLower(_Inout_ strhandle io);
592
617int32 strSplit(_Inout_ sa_string* _Nonnull out, _In_opt_ strref s, _In_opt_ strref sep, bool empty);
618
640int32 strSplitAny(_Inout_ sa_string* _Nonnull out, _In_opt_ strref s, _In_opt_ strref chars,
641 bool empty);
642
663int32 strSplitMax(_Inout_ sa_string* _Nonnull out, _In_opt_ strref s, _In_opt_ strref sep,
664 bool empty, int32 maxparts);
665
686int32 strSplitAnyMax(_Inout_ sa_string* _Nonnull out, _In_opt_ strref s, _In_opt_ strref chars,
687 bool empty, int32 maxparts);
688
713bool strSplitNext(_In_opt_ strref s, _Inout_ int32* _Nonnull pos, _In_opt_ strref sep,
714 _Inout_ strhandle out);
715
736bool strSplitNextAny(_In_opt_ strref s, _Inout_ int32* _Nonnull pos, _In_opt_ strref chars,
737 _Inout_ strhandle out);
738
761bool strJoin(_Inout_ strhandle out, _In_ sa_string arr, _In_opt_ strref sep);
762
786uint8 strGetChar(_In_opt_ strref str, int32 i);
787
811void strSetChar(_Inout_ strhandle str, int32 i, uint8 ch);
812
814
815CX_C_END
string * strhandle
Pointer to a string variable.
Definition strbase.h:64
int32 strSplitAny(sa_string *out, strref s, strref chars, bool empty)
bool strReplaceChar(strhandle o, strref s, char from, char to)
bool strAppend(strhandle io, strref s)
bool strAppendBytes(strhandle io, _In_reads_bytes_opt_(sz) const void *buf, uint32 sz)
uint8 strGetChar(strref str, int32 i)
bool strSubStrI(strhandle io, int32 b, int32 e)
bool strRTrim(strhandle o, strref s, strref chars)
bool strConcat(strhandle o, strref s1, strref s2)
bool strSplitNextAny(strref s, int32 *pos, strref chars, strhandle out)
bool strFillChar(strhandle o, uint8 ch, uint32 n)
int32 strSplit(sa_string *out, strref s, strref sep, bool empty)
bool strReplace(strhandle o, strref s, strref find, strref repl, int32 max)
bool strTrim(strhandle o, strref s, strref chars)
bool strConcatC(strhandle o, strhandle sc1, strhandle sc2)
bool strReplaceChari(strhandle o, strref s, char from, char to)
bool strErase(strhandle o, strref s, int32 b, int32 e)
bool strSubStr(strhandle o, strref s, int32 b, int32 e)
void strLower(strhandle io)
bool strPrepend(strref s, strhandle io)
bool strSplitNext(strref s, int32 *pos, strref sep, strhandle out)
int32 strSplitMax(sa_string *out, strref s, strref sep, bool empty, int32 maxparts)
bool strInsert(strhandle o, strref s, int32 off, strref ins)
bool strReplacei(strhandle o, strref s, strref find, strref repl, int32 max)
void strUpper(strhandle io)
bool strRepeat(strhandle o, strref s, uint32 n)
bool strJoin(strhandle out, sa_string arr, strref sep)
bool strSubStrC(strhandle o, strhandle sc, int32 b, int32 e)
void strAppendChar(strhandle io, uint8 ch)
void strSetChar(strhandle str, int32 i, uint8 ch)
int32 strSplitAnyMax(sa_string *out, strref s, strref chars, bool empty, int32 maxparts)
bool strLTrim(strhandle o, strref s, strref chars)
Dynamic arrays with type-safe generic programming.
Core string types and fundamental operations.