trim_right_copy

Top  Previous  Next

Scripts > Class elements and c++ instructions > String manipulation > trim_right_copy

 

Prototype

 

str trim_right_copy(const str& xs)

 

Description

 

Remove all trailing spaces from the input. The result is a trimmed copy of the input.

 

 

Example:

 

str s = trim_right_copy("   TextTransformer   ");

 

has the result: s == "   TextTransformer".

 

 

This command is useful, to extract text, which is covered by a SKIP symbol. When the parser recognizes the token after the SKIP symbol, leading spaces are ignored, but not the spaces before the token. For example:

 

SKIP {{ out << trim_right_copy( xState.str()); }} "$"

 

input        : "        77.74       $"

output        : "77.74"

 

xState.str() == "77.74       " and trim_right_copy(xState.str()) == "77.74".

 



This page belongs to the TextTransformer Documentation

Home  Content  German