StrRStrip
Description
Strip only trailing characters from s, returning a new Str. The original s is unmodified.
Parameters
| Name | Direction | Description |
|---|---|---|
s |
in | Str to strip. |
chars_to_strip |
in | Optional Zstr listing characters to strip. NULL strips standard ASCII whitespace. |
Success
Returns a new Str with trailing characters removed. s is not modified.
Failure
Returns a zero-length Str when the whole input strips away or on allocator OOM.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Str.Ops.c:263:
// Test StrRStrip
stripped = StrRStrip(&s1, NULL);
result = result && (ZstrCompare(StrBegin(&stripped), " Hello") == 0);
StrDeinit(&stripped);- In
Str.Ops.c:280:
StrDeinit(&stripped);
stripped = StrRStrip(&s1, "*");
result = result && (ZstrCompare(StrBegin(&stripped), "***Hello") == 0);
StrDeinit(&stripped);
Last updated on