Add trim to ZString.
This commit is contained in:
parent
a1cc142a59
commit
d7ef47cd49
@ -397,6 +397,11 @@ namespace coreutils {
|
|||||||
return ZString(temp, tempend - temp);
|
return ZString(temp, tempend - temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZString ZString::trim() {
|
||||||
|
skipWhitespace();
|
||||||
|
return unparsed();
|
||||||
|
}
|
||||||
|
|
||||||
int ZString::find(ZString comparator) {
|
int ZString::find(ZString comparator) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
char *temp = cursor;
|
char *temp = cursor;
|
||||||
|
@ -321,7 +321,13 @@ namespace coreutils {
|
|||||||
///
|
///
|
||||||
|
|
||||||
ZString goeol();
|
ZString goeol();
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
|
ZString trim();
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Return a block of data as a ZString from the cursor location for
|
/// Return a block of data as a ZString from the cursor location for
|
||||||
/// the number of bytes specified by size.
|
/// the number of bytes specified by size.
|
||||||
|
@ -91,5 +91,8 @@ int main(int argc, char **argv) {
|
|||||||
std::cout << test16.substring(10, 4) << std::endl;
|
std::cout << test16.substring(10, 4) << std::endl;
|
||||||
std::cout << test16.substring(0, 7) << std::endl;
|
std::cout << test16.substring(0, 7) << std::endl;
|
||||||
std::cout << test16.substring(18, 20) << std::endl;
|
std::cout << test16.substring(18, 20) << std::endl;
|
||||||
|
|
||||||
|
coreutils::ZString test17(" hello there ");
|
||||||
|
std::cout << "[" << test17.trim() << "]" << std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user