Get a string from a UTF-8 encoded C string If byteLength
is not provided, the string is assumed to be null-terminated.
Symbol
CString.constructor
The pointer to the C string
bytes to skip before reading
bytes to read
var ptr = lib.symbols.getVersion();
console.log(new CString(ptr));
Referenced types
class CString
Get a string from a UTF-8 encoded C string If byteLength
is not provided, the string is assumed to be null-terminated.
var ptr = lib.symbols.getVersion();
console.log(new CString(ptr));
Iterator
Returns a new String consisting of the single UTF-16 code unit located at the specified index.
@param indexThe zero-based index of the desired code unit. A negative index will count back from the last item.
Returns the character at the specified index.
@param posThe zero-based index of the desired character.
Returns the Unicode value of the character at the specified location.
@param indexThe zero-based index of the desired character. If there is no character at the specified index, NaN is returned.
Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point value of the UTF-16 encoded code point starting at the string element at position pos in the String resulting from converting this object to a String. If there is no element at that position, the result is undefined. If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
Returns a string that contains the concatenation of two or more strings.
@param stringsThe strings to append to the end of the string.
Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at endPosition – length(this). Otherwise returns false.
Returns true if searchString appears as a substring of the result of converting this object to a String, at one or more positions that are greater than or equal to position; otherwise, returns false.
@param searchStringsearch string
@param positionIf position is undefined, 0 is assumed, so as to search all of the String.
Returns the position of the first occurrence of a substring.
@param searchStringThe substring to search for in the string
@param positionThe index at which to begin searching the String object. If omitted, search starts at the beginning of the string.
Returns true if all leading surrogates and trailing surrogates appear paired and in order.
Returns the last occurrence of a substring in the string.
@param searchStringThe substring to search for.
@param positionThe index at which to begin searching. If omitted, the search begins at the end of the string.
Determines whether two strings are equivalent in the current locale.
@param thatString to compare to target string
Determines whether two strings are equivalent in the current or specified locale.
@param thatString to compare to target string
@param localesA locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
@param optionsAn object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
Determines whether two strings are equivalent in the current or specified locale.
@param thatString to compare to target string
@param localesA locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
@param optionsAn object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
Matches a string with a regular expression, and returns an array containing the results of that search.
@param regexpA variable name or string literal containing the regular expression pattern and flags.
Matches a string or an object that supports being matched against, and returns an array containing the results of that search, or null if no matches are found.
@param matcherAn object that supports being matched against.
Matches a string with a regular expression, and returns an iterable of matches containing the results of that search.
@param regexpA variable name or string literal containing the regular expression pattern and flags.
Returns the String value result of normalizing the string into the normalization form named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
@param formApplicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default is "NFC"
Returns the String value result of normalizing the string into the normalization form named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
@param formApplicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default is "NFC"
Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. The padding is applied from the end (right) of the current string.
@param maxLengthThe length of the resulting string once the current string has been padded. If this parameter is smaller than the current string's length, the current string will be returned as it is.
@param fillStringThe string to pad the current string with. If this string is too long, it will be truncated and the left-most part will be applied. The default value for this parameter is " " (U+0020).
Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. The padding is applied from the start (left) of the current string.
@param maxLengthThe length of the resulting string once the current string has been padded. If this parameter is smaller than the current string's length, the current string will be returned as it is.
@param fillStringThe string to pad the current string with. If this string is too long, it will be truncated and the left-most part will be applied. The default value for this parameter is " " (U+0020).
Returns a String value that is made from count copies appended together. If count is 0, the empty string is returned.
@param countnumber of copies to append
Replaces text in a string, using a regular expression or search string.
@param searchValueA string or regular expression to search for.
@param replaceValueA string containing the text to replace. When the searchValue is a
RegExp
, all matches are replaced if theg
flag is set (or only those matches at the beginning, if they
flag is also present). Otherwise, only the first match of searchValue is replaced.replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): stringReplaces text in a string, using a regular expression or search string.
@param searchValueA string to search for.
@param replacerA function that returns the replacement text.
replace(searchValue: { [replace](string: string, replaceValue: string): string }, replaceValue: string): stringPasses a string and replaceValue to the
[Symbol.replace]
method on searchValue. This method is expected to implement its own replacement algorithm.@param searchValueAn object that supports searching for and replacing matches within a string.
@param replaceValueThe replacement text.
replace(searchValue: { [replace](string: string, replacer: (substring: string, ...args: any[]) => string): string }, replacer: (substring: string, ...args: any[]) => string): stringReplaces text in a string, using an object that supports replacement within a string.
@param searchValueA object can search for and replace matches within a string.
@param replacerA function that returns the replacement text.
Replace all instances of a substring in a string, using a regular expression or search string.
@param searchValueA string to search for.
@param replaceValueA string containing the text to replace for every successful match of searchValue in this string.
replaceAll(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): stringReplace all instances of a substring in a string, using a regular expression or search string.
@param searchValueA string to search for.
@param replacerA function that returns the replacement text.
Finds the first substring match in a regular expression search.
@param regexpThe regular expression pattern and applicable flags.
Finds the first substring match in a regular expression search.
@param searcherAn object which supports searching within a string.
Returns a section of a string.
@param startThe index to the beginning of the specified portion of stringObj.
@param endThe index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. If this value is not specified, the substring continues to the end of stringObj.
Split a string into substrings using the specified separator and return them as an array.
@param separatorA string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.
@param limitA value used to limit the number of elements returned in the array.
Split a string into substrings using the specified separator and return them as an array.
@param splitterAn object that can split a string.
@param limitA value used to limit the number of elements returned in the array.
Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false.
Returns the substring at the specified location within a String object.
@param startThe zero-based index number indicating the beginning of the substring.
@param endZero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. If end is omitted, the characters from start through the end of the original string are returned.
Converts all alphabetic characters to lowercase, taking into account the host environment's current locale.
Converts all alphabetic characters to lowercase, taking into account the host environment's current locale.
Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale.
Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale.
Converts all the alphabetic characters in a string to lowercase.
Returns a string representation of a string.
Converts all the alphabetic characters in a string to uppercase.
Returns a string where all lone or out-of-order surrogates have been replaced by the Unicode replacement character (U+FFFD).
Removes the leading and trailing white space and line terminator characters from a string.
Removes the trailing white space and line terminator characters from a string.
Removes the leading white space and line terminator characters from a string.
Returns the primitive value of the specified object.
Return the String value whose elements are, in order, the elements in the List elements. If length is 0, the empty string is returned.
- static raw(template: { raw: readonly string[] | ArrayLike<string> }, ...substitutions: any[]): string
String.raw is usually used as a tag function of a Tagged Template String. When called as such, the first argument will be a well formed template call site object and the rest parameter will contain the substitution values. It can also be called directly, for example, to interleave strings and values from your own tag function, and in this case the only thing it needs from the first argument is the raw property.
@param templateA well-formed template string call site representation.
@param substitutionsA set of substitution values.