NormalizeWhitespace (open)

Remove extra internal whitespace from a string

Syntax

// Core function, no LOADLIB necessary

STRING FUNCTION NormalizeWhitespace(STRING text)

Parameters

STRING text

The string to normalize

Return value

STRING

The normalized string

Description

This function reduces all sequences of whitespaces (tab, cr, lf, space) to a single space within a string. Whitespace at the beginning and the end of the string is normalized, but not trimmed.

Examples

// returns ' abc def '
STRING example1 := NormalizeWhitespace("  abc  def  ");

// returns ' Hello, World'
STRING example1 := NormalizeWhitespace("\r\n Hello, \t\t \r \n World");