Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface String

Extend the String prototype with some API functions used by AntOS API

interface

String

Hierarchy

  • String

Index

Methods

__

  • __(): string
  • Check if the current string is translatable, if it is the case, translate the string to the language specified in the current system locale setting.

    A translatable string is a string in the following form: "__(example string)"

    memberof

    String

    Returns string

__v

  • Parse the current string and convert it to an object of type Version if the string is in the format recognized by Version, e.g.: 1.0.1-a

    memberof

    String

    Returns Version

asBase64

  • asBase64(): string
  • Convert the current string to base 64 string

    memberof

    String

    Returns string

asFileHandle

asUint8Array

  • asUint8Array(): Uint8Array
  • Convert the current string to uint8 array

    memberof

    String

    Returns Uint8Array

escape

  • escape(): string
  • Escape the current string using backslash

    memberof

    String

    Returns string

f

format

  • format(...args: any[]): string
  • Format the current using input parameters. The current string should be a formatted string in the following form:

    "example string: {0} and {1}".format("hello", "world")
    // return "example string: hello and world"
    
    memberof

    String

    Parameters

    • Rest ...args: any[]

    Returns string

hash

  • hash(): number

l

  • l(): string
  • Translate current string to the language specified by the system locale setting

    memberof

    String

    Returns string

trimBy

  • trimBy(arg: string): string
  • Trim both left and right of a string by a mask string

    memberof

    String

    Parameters

    • arg: string

      specifies a sub-string to be removed

    Returns string

trimFromLeft

  • trimFromLeft(arg: string): string
  • Trim left of a string by a mask string

    memberof

    String

    Parameters

    • arg: string

      specifies a sub-string to be removed

    Returns string

trimFromRight

  • trimFromRight(arg: string): string
  • Trim right of a string by a mask string

    memberof

    String

    Parameters

    • arg: string

      specifies a sub-string to be removed

    Returns string

unescape

  • unescape(): string
  • Unescape all escaped characters on the string using \

    memberof

    String

    Returns string