Skip to content

Format

Spice
import "std/text/format";

Functions

toUpper

Spice
public f<char> toUpper(char c)

Returns the given char as upper case version

Parameters

Name Type Description
c char

Returns: char — Char in upper case

toUpper

Spice
public f<String> toUpper(const String& text)

Returns the given text in caps

Parameters

Name Type Description
text const String&

Returns: String — Text in caps

toLower

Spice
public f<char> toLower(char c)

Returns the given char as lower case version

Parameters

Name Type Description
c char

Returns: char — Char in lower case

toLower

Spice
public f<String> toLower(const String& text)

Returns the given text in all-lower letters

Parameters

Name Type Description
text const String&

Returns: String — Text in all-lower letters

capitalize

Spice
public f<String> capitalize(const String& text)

Returns the given text in capitalized form

Parameters

Name Type Description
text const String&

Returns: String — Capitalized text

formatThousandsDelimiter

Spice
public f<String> formatThousandsDelimiter(int input, char delimiter = ',')

Format the given number with thousands delimiter

Parameters

Name Type Description
input int Number
delimiter char Custom thousands delimiter (default: ',')

Returns: String — Formatted string

formatStorageSize

Spice
public f<String> formatStorageSize(unsigned long bytes, bool useFactor1024 = false)

Returns a formatted storage string (e.g. 1.4 MB for 1,500,000)

Parameters

Name Type Description
bytes unsigned long Number of bytes
useFactor1024 bool Use factor 1024 instead the default factor of 1000 (default: false)

Returns: String — Formatted string