Skip to content

Latest commit

 

History

History
58 lines (29 loc) · 3.23 KB

string.md

File metadata and controls

58 lines (29 loc) · 3.23 KB

string API

The standard string APIs are implemented by binaryen API. Below are the string APIs supported by Wasmnizer-ts.

Please note that specific implementations may differ slightly from libraries like JavaScript Core Library. For uniform APIs, hyperlinks to their descriptions will be provided. In situations where there are variations, this document offers API descriptions along with explanations for the differences.

  • concat(...strings: string[]): string

  • slice(start?: number, end?: number): string

  • charAt(pos: number): string

  • charCodeAt(index: number): number

  • substring(start: number, end?: number): string

  • trim(): string

  • toLowerCase(): string

  • toUpperCase(): string

  • indexOf(searchString: string): number

    Description: Searches for the first occurrence of a specified substring (searchString) within a string and returns the index at which it is found, otherwise, returns -1.

    Passing the starting search index has not been implemented yet.

  • lastIndexOf(str: string): number

    Description: Searches for the last occurrence of a specified substring (str) within a string and returns the index (position) at which it is found, otherwise, returns -1.

    Passing the starting search index has not been implemented yet.

  • split(sep: string): string[]

    Description: Splits a string into an array of substrings based on a specified separator (sep).

    RegExp has not been implemented yet.

  • replace(from: string, to: string): string

    Description: Replaces the first occurrence of a specified substring (from) within a string with another substring (to) and returns the resulting modified string.

    RegExp has not been implemented yet.

  • match(pattern: string): string[]

    Description: Searches for the first occurrence of a specified regular expression (pattern) within a string and returns an array containing the matched substring.

    RegExp has not been implemented yet.

  • search(pattern: string): number

    Description: Searches for a specified regular string (pattern) within a string and returns the index of the first occurrence of the matched substring or -1 if no match is found.

    RegExp has not been implemented yet.