new AxString(sourcenon-null, radixnon-null)
Creates a new AxString
AxString is just a wrapper over javascript's reglar string and is given primarily for consistency with the C++ implementation of Axis
It can freely be manipulated by both the AxString functions and the regular javascript string functions of AxString.contents
Parameters:
Name | Type | Description |
---|---|---|
source |
* | A source to use as a contents of the string |
radix |
Integer | If a source representing an integer number is provided, the radix parameter is used to denote the source's base. If not provided, a value of 10 is assumed |
- Source:
Methods
(static) DecodeUtf8Char(utf, utfOffset) → {Object}
Decodes UTF-8 data into a string and returns the number of decoded bytes
Parameters:
Name | Type | Description |
---|---|---|
utf |
Uint8Array | The source UTF-8 encoded data of the character |
utfOffset |
Number | The offset in bytes, at which the the character is located |
- Source:
Returns:
An object containing the decoded character code point and the number of decoded bytes
- Type
- Object
(static) DecodeUtf8String(result, utfData, utfDataLength, utfDataOffset) → {Number}
Decodes a string from UTF-8
Parameters:
Name | Type | Description |
---|---|---|
result |
AxString | The string where the result will be stored |
utfData |
ArrayBuffer | The source of the utf-encoded string |
utfDataLength |
Number | The length in bytes of the utf data |
utfDataOffset |
Number | The offset in bytes, at which the the string is located |
- Source:
Returns:
The number of bytes decoded from the utfData
- Type
- Number
(static) EncodeUtf8String(result, resultOffset, str) → {Number}
Encodes a string in UTF-8
Parameters:
Name | Type | Description |
---|---|---|
result |
ArrayBuffer | The destination buffer where the encoded result will be stored |
resultOffset |
Number | The offset in bytes, at which the encoded data should be written |
str |
AxString | The source string to be encoded |
- Source:
Returns:
The number of bytes in the encoded result
- Type
- Number
(static) GetStringAsUTF8Length(str) → {Number}
Determines the number of bytes, required to encode a string in UTF-8 format
Parameters:
Name | Type | Description |
---|---|---|
str |
AxString | The string for which to determine |
- Source:
Returns:
The number of bytes decoded from the utfData
- Type
- Number
(static) GetUTF8AsStringLength(utfData, utfDataOffset, utfDataLength) → {Number}
Determines the number of characters, encoded in a UTF-8 data sequence
Parameters:
Name | Type | Description |
---|---|---|
utfData |
ArrayBuffer | The source of the utf-encoded string |
utfDataOffset |
Number | The offset in bytes, at which the the string is located |
utfDataLength |
Number | The size in bytes of the utf data to be decoded |
- Source:
Returns:
The number of bytes decoded from the utfData
- Type
- Number
Compare(str) → {Integetr}
Compares against the given string
Parameters:
Name | Type | Description |
---|---|---|
str |
AxString | The string to compare against |
- Source:
Returns:
0 if the given string exactly matches, 1 if it is greater, -1 if it is lesser.
- Type
- Integetr
EnsureCapacity(length)
Makes sure there is the amount of capacity deisred. If the desired capacity already fits in the current one, no change is made
Parameters:
Name | Type | Description |
---|---|---|
length |
Integer | Length which to ensure to be available |
- Source:
ResizeCapacity(newCapacity, keepContentsnon-null)
Sets capacity exactly to the desired amount
Parameters:
Name | Type | Description |
---|---|---|
newCapacity |
Integer | The new capacity to be set |
keepContents |
Boolean | If true, contents of the string will be kept as much as the new capacity allows |
- Source:
SetLength(length)
Sets the length of the string. If the new length is greater than the current one, the added characters are undefined
Parameters:
Name | Type | Description |
---|---|---|
length |
Integer | Exact length to be set |
- Source: