Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site













SourceForge.net Logo

Split, Join, Merge

 

Utility functions for splitting and joining Strings and WStrings.

 

Function List

 

Vector<StringSplit(int maxcount, const char *s, const char * (*text_filter)(const char *), bool ignoreempty = true)

Vector<StringSplit(int maxcount, const char *s, int (*filter)(int), bool ignoreempty = true)

Vector<StringSplit(int maxcount, const char *s, int chr, bool ignoreempty = true)

Vector<StringSplit(int maxcount, const char *s, const char *text, bool ignoreempty = true)

Vector<StringSplit(const char *s, const char * (*text_filter)(const char *), bool ignoreempty = true)

Vector<StringSplit(const char *s, int (*filter)(int), bool ignoreempty = true)

Vector<StringSplit(const char *s, int chr, bool ignoreempty = true)

Vector<StringSplit(const char *s, const char *text, bool ignoreempty = true)

Vector<WStringSplit(int maxcount, const wchar *s, const wchar * (*text_filter)(const wchar *), bool ignoreempty = true)

Vector<WStringSplit(int maxcount, const wchar *s, int (*filter)(int), bool ignoreempty = true)

Vector<WStringSplit(int maxcount, const wchar *s, int chr, bool ignoreempty = true)

Vector<WStringSplit(int maxcount, const wchar *s, const wchar *text, bool ignoreempty = true)

Vector<WStringSplit(const wchar *s, const wchar * (*text_filter)(const wchar *), bool ignoreempty = true)

Vector<WStringSplit(const wchar *s, int (*filter)(int), bool ignoreempty = true)

Vector<WStringSplit(const wchar *s, int chr, bool ignoreempty = true)

Vector<WStringSplit(const wchar *s, const wchar *text, bool ignoreempty = true)

Splits text s into subtexts originating between delimiters. Delimiter can be defined as single character chr, text filter function text_filter (returns position after delimiter or NULL if delimiter is not at current character), character filter function filter (returns non-zero for delimiter character) or as string text. If ignoreempty is true (default), empty subtexts are ignored. maxcount can define upper limit of number of subtexts.

 


 

String Join(const Vector<String>& im, const String& delim, bool ignoreempty = false)

WString Join(const Vector<WString>& im, const WString& delim, bool ignoreempty = false)

Joins texts from im, inserting delim between them. If ignoreempty is true, empty texts are ignored. Note that the default value of ignoreempty is the opposite of one in Split.

 


 

bool SplitTo(const char *s, int delim, bool ignoreempty, String& p1...)

bool SplitTo(const char *s, int delim, String& p1...)

bool SplitTo(const char *s, int (*filter)(int), String& p1...)

bool SplitTo(const char *s, const char *delim, bool ignoreempty, String& p1...)

bool SplitTo(const char *s, const char *delim, String& p1...)

bool SplitTo(const wchar *s, int delim, bool ignoreempty, WString& p1...)

bool SplitTo(const wchar *s, int delim, WString& p1...)

bool SplitTo(const wchar *s, int (*filter)(int), WString& p1...)

bool SplitTo(const wchar *s, const wchar *delim, bool ignoreempty, WString& p1...)

bool SplitTo(const wchar *s, const wchar *delim, WString& p1...)

Splits text into one or more targets substrings, inserting them into string variables (current implementation supports up to 8 output strings). Returns true if the source text contains enough substrings. Delimiter can be defined as single character chr, character filter function filter (returns non-zero for delimiter character) or as string text. If ignoreempty is true (default), empty subtexts are ignored. maxcount can define upper limit of number of subtexts.

 


 

String Merge(const char *delim, String& p1...)

WString Merge(const wchar *delim, WString& p1...)

Merges substrings. Returns source strings concatenated with delimiter put between them, however empty strings are ignored (means Merge(";", "1", "") results in "1", not "1;").

 


 

void MergeWith(String& dest, const char *delim, String& p1...)

void MergeWith(WString& dest, const wchar *delim, WString& p1...)

Merges substrings with dest. dest and source strings concatenated with delimiter put between them are stored, however empty strings are ignored.

 

Last edit by cxl on 04/22/2014. Do you want to contribute?. T++