Module: Toybox.StringUtil

Overview

The StringUtil module contains String utility functions

Since:

API Level 1.3.0

Classes Under Namespace

Classes: InvalidHexStringException

Constant Summary

CharacterEncoding

Since:

API Level 1.3.0

Name Value Since Description See Also
CHAR_ENCODING_UTF8 0

API Level 3.0.0

Representation

Since:

API Level 1.3.0

Name Value Since Description See Also
REPRESENTATION_STRING_BASE64 0

API Level 3.0.0

REPRESENTATION_STRING_HEX 1

API Level 3.0.0

REPRESENTATION_STRING_PLAIN_TEXT 2

API Level 3.0.0

REPRESENTATION_BYTE_ARRAY 3

API Level 3.0.0

Instance Method Summary collapse

Instance Method Details

charArrayToString(charArray as Lang.Array<Lang.Char>) as Lang.String

Given an Array of Char objects, return the String equivalent

Parameters:

  • charArray(Lang.Array)

    An Array of Char objects

Returns:

  • Lang.String

    The String representation of the input Array

Since:

API Level 1.3.0

convertEncodedString(input as Lang.String or Lang.ByteArray, options as { :fromRepresentation as StringUtil.Representation, :toRepresentation as StringUtil.Representation, :encoding as StringUtil.CharacterEncoding }) as Lang.String or Lang.ByteArray

Convert a String or ByteArray representation to a String or ByteArray representation whose underlying byte format corresponds to the provided input options.

Parameters:

Returns:

Since:

API Level 3.0.0

Throws:

encodeBase64(string as Lang.String) as Lang.String

Encodes a String in base64

Parameters:

Returns:

Since:

API Level 1.3.0

utf8ArrayToString(utf8Array as Lang.Array<Lang.Number>) as Lang.String

Given an Array of UTF-8 bytes, return the String equivalent

Parameters:

  • utf8Array(Lang.Array)

    An Array of UTF-8 bytes

Returns:

  • Lang.String

    The String representation of the input Array

Since:

API Level 1.3.0

Throws:


Generated Sep 23, 2024, 3:32:49 PM