Add trim to ZString.

This commit is contained in:
Brad Arant 2024-09-24 11:14:58 -07:00
parent a1cc142a59
commit d7ef47cd49
3 changed files with 15 additions and 1 deletions

View File

@ -397,6 +397,11 @@ namespace coreutils {
return ZString(temp, tempend - temp);
}
ZString ZString::trim() {
skipWhitespace();
return unparsed();
}
int ZString::find(ZString comparator) {
int count = 0;
char *temp = cursor;

View File

@ -321,7 +321,13 @@ namespace coreutils {
///
ZString goeol();
///
///
///
ZString trim();
///
/// Return a block of data as a ZString from the cursor location for
/// the number of bytes specified by size.

View File

@ -91,5 +91,8 @@ int main(int argc, char **argv) {
std::cout << test16.substring(10, 4) << std::endl;
std::cout << test16.substring(0, 7) << std::endl;
std::cout << test16.substring(18, 20) << std::endl;
coreutils::ZString test17(" hello there ");
std::cout << "[" << test17.trim() << "]" << std::endl;
}