TRANSLATE

Format

TRANSLATE( text , format_from , format_to )

Function

Arguments

text
The string to replace.
format_from
The list of characters before replacement. See "About formatting".
format_to
The list of characters after replacement. See "About formatting". Empty string to delete.

About formatting

Return value

Related

Version

Example

Write the following script to convert hiragaka to katakana and katakana to hiragana.

Translation note: the following example is reliant on a basic understanding of Japanese text. See underneath for a similar concept in English.

_wokyu = TRANSLATE('ティータイムは大事にしないとネー','ぁ-ゖァ-ヶ','ァ-ヶぁ-ゖ')

//Contents of _wokyu = てぃーたいむハ大事ニシナイトねー
//The Unicode table specifies the overlapping range of katakana and hiragana, "ァ-ヶ"
//If you are writing a dictionary in Shift JIS, "ゖ" will be garbled, so for now, use the following.

_wokyu = TRANSLATE('ティータイムは大事にしないとネー','ぁ-んァ-ン','ァ-ンぁ-ん')

Translation note: this is an additional example provided to show how this function can be used in English. Here, it is used to swap uppercase letters and lowercase letters.

_wokyu = TRANSLATE('Tea time should be cherished','a-zA-Z','A-Za-z')

//Contents of _wokyu = 'tEA TIME SHOULD BE CHERISHED'