StringSearch.trim

Trims white space from "str".

struct StringSearch(bool wide_char = false)
static
TChar[]
trim
(
TChar
)
(
TChar[] str
,
bool terminate = false
)

Parameters

str TChar[]

input string

terminate bool

set to true to null-terminate the resulting string if the input string is null-terminated

Return Value

Type: TChar[]

the resulting string

Examples

test!("==")(StringSearch!().trim("trim"), "trim"[]);

test!("==")(StringSearch!().trim("  trim"), "trim"[]);
test!("==")(StringSearch!().trim("\ttrim"), "trim"[]);
test!("==")(StringSearch!().trim(" \t trim"), "trim"[]);

test!("==")(StringSearch!().trim("trim  "), "trim"[]);
test!("==")(StringSearch!().trim("trim\t"), "trim"[]);
test!("==")(StringSearch!().trim("trim \t "), "trim"[]);

test!("==")(StringSearch!().trim("  trim  "), "trim"[]);
test!("==")(StringSearch!().trim("\ttrim\t"), "trim"[]);
test!("==")(StringSearch!().trim("\t \ttrim \t "), "trim"[]);

Meta