Skip to content

StrRStrip

StrRStrip

Description

Strip only trailing whitespace (or optional custom characters) from the given Str object. Returns a new Str object. Original is unmodified.

Parameters

Name Direction Description
str in Str object to strip
chars_to_strip in Optional zero-terminated char pointer specifying which characters to strip. If NULL, standard ASCII whitespace is stripped.

Success

A new Str object with trailing characters removed

Failure

A zero-length Str object

Usage example (Cross-references)

Usage examples (Cross-references)
    
        // Test StrRStrip
        stripped = StrRStrip(&s1, NULL);
        result   = result && (ZstrCompare(stripped.data, "  Hello") == 0);
        StrDeinit(&stripped);
        StrDeinit(&stripped);
    
        stripped = StrRStrip(&s1, "*");
        result   = result && (ZstrCompare(stripped.data, "***Hello") == 0);
        StrDeinit(&stripped);
Last updated on