Skip to content

ProtoString Conversion Methods

Seth Clydesdale edited this page Jun 13, 2015 · 22 revisions

<< Back to ProtoString Method Reference

The conversion methods allow you to convert strings into other characters, data types, or encode the characters in a string as their character code counterpart. A decoding method is also provided, so that you can decode encoded text strings.

Conversion Methods

Method Description
encodeAs() Encodes a text string as Decimal, Hex, Binary, or HTML entity numbers.
decodeAs() Decodes a text string that has been encoded as Decimal, Hex, Binary, or HTML entity numbers.
toEnclosed() Converts Alphanumeric characters into Enclosed Alphanumeric characters.
toLatin() Converts accented and some special characters to basic Latin.
toObject() Converts a string literal into an object.

Dropped Conversion Methods

The following methods are no longer available in the main protostring.js file. They are however, still available via the archive, but it's recommended that you use the encodeAs() and decodeAs() methods instead.

Method Description
toDecimal() Encodes all characters in a string as their Decimal counterpart.
fromDecimal() Decodes all characters in a string that have been encoded as Decimal.
toHex() Encodes all characters in a string as their Hexadecimal counterpart.
fromhex() Decodes all characters in a string that have been encoded as Hexaecimal.
toBinary() Encodes all characters in a string as their Binary counterpart.
fromBinary() Decodes all characters in a string that have been encoded as Binary.
toEntity() Encodes all characters in a string as an HTML entity number.
fromEntity() Decodes all characters in a string that have been encoded as an HTML entity number.
Clone this wiki locally