1 #include "wvstringlist.h"
2 #include "wvhashtable.h"
10 WvString s(
"one"), s2(
"two"), s3(
"three"), foo(
"a : b : c : d");
17 WvStringList::Iter i(l);
20 for (i.rewind(); i.next();)
21 printf(
"The list: %s\n", i().cstr());
29 for (i.rewind(); i.next();)
30 printf(
"Split foo: %s\n", i().cstr());
38 l.
split(foo,
": ", 2);
42 for (i.rewind(); i.next();)
43 printf(
"Split foo (2): %s\n", i().cstr());
50 l.
split(foo,
": ", 3);
54 for (i.rewind(); i.next();)
55 printf(
"Split foo (3): %s\n", i().cstr());
77 char const *p =
"hello";
78 char const *p2 =
"world";
79 char const *
const array[] = {p, p2, NULL};
82 printf(
"After fill: %s\n", l.
join(
",").
cstr());
93 printf(
"After fill: %s\n", l.
join(
",").
cstr());
const char * cstr() const
return a (const char *) for this string.
This is a WvList of WvStrings, and is a really handy way to parse strings.
WvString join(const char *joinchars=" ") const
concatenates all elements of the list seperating on joinchars
void split(WvStringParm s, const char *splitchars=" \t\r\n", int limit=0)
split s and form a list ignoring splitchars (except at beginning and end) ie.
WvString popstr()
get the first string in the list, or an empty string if the list is empty.
WvString is an implementation of a simple and efficient printable-string class.