mlreportgen.utils.normalizeString class

Package: mlreportgen.utils
Superclasses:

Remove extra spaces and line feeds from string

Construction

n_strchar = normalizeString(strchar) returns a normalized string or character vector. A normalized string has its leading and trailing spaces removed, and its return carriages and tabs replaced with a single space. The returned value is of the same type as the input type.

Input Arguments

expand all

String or character vector to normalize.

Output Arguments

expand all

Normalized string or character vector, returned as the same type as the input type.

Examples

collapse all

import mlreportgen.utils.*
str = "    a sample string "
n_strchar = normalizeString(str)
str = 
    "    a sample string "

n_strchar = 
    "a sample string"
import mlreportgen.utils.*
char_vec = '  a sample character vector'
char_vec1 = [char_vec newline  ' plus a new line  ']
n_strchar = normalizeString(char_vec1)
char_vec =
    '  a sample character vector    '

char_vec1 =
    '  a sample character vector    
      plus a new line  '

n_strchar =
    'a sample character vector plus a new line'

Introduced in R2018b