-
Couldn't load subscription status.
- Fork 0
ProtoString decodeAs() Method
Seth Clydesdale edited this page May 23, 2015
·
5 revisions
Decoding encoded text strings with ProtoString.
/*** DECIMAL CONVERSION ***/
'72 101 108 108 111'.decodeAs('decimal'); // returns 'Hello'
/*** HEXADECIMAL CONVERSION ***/
'48 65 6c 6c 6f'.decodeAs('hex'); // returns 'Hello'
/*** BINARY CONVERSION ***/
'1001000 1100101 1101100 1101100 1101111'.decodeAs('binary'); // returns 'Hello'
/*** ENTITY CONVERSION ***/
'&$♥♦♣'.decodeAs('entity'); // returns '&$♥♦♣'The decodeAs() method is used to decode all the encoded characters in a string from one of the following types.
- Decimal
- Hexadecimal
- Binary
- HTML entity numbers
String.decodeAs(type);| Parameter | Description |
|---|---|
| type | A string value which determines the decoding method. Possible values are : decimal, hex, binary, and entity. Defaults to decimal conversion if left undefined. |
Home • History • ProtoString • Created by Seth Clydesdale