Completed cosing of substring.
This commit is contained in:
1 parent
39fd88cad9
commit
a1cc142a59
2 files changed
+13
-1
No files matched your search
@@ -171,6 +171,13 @@ namespace coreutils {
|
||||
}
|
||||
|
||||
ZString ZString::substring(int start, int len) {
|
||||
char *end = data + length;
|
||||
char *startChar = data + start;
|
||||
char *endChar = startChar + len;
|
||||
char newlen = endChar > end ? endChar - end: len;
|
||||
if(startChar < end) {
|
||||
return ZString(startChar, newlen);
|
||||
}
|
||||
return ZString();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user