Internationalization function

1, IsAllArabic ()

Power: Determines whether the specified string consists entirely of Arabic characters. This function can only be used in the Arabic version of PowerBuilder.

Arabic: Isall (string)

Parameter: string: the string to be tested.

Return value: Boolean. The function returns TRUE if the string content consists entirely of Arabic characters, FALSE otherwise. This function also returns FALSE if the string contains numbers, Spaces, and punctuation marks. This function always returns FALSE if PowerBuilder is not in Arabic.

Example: Under a version of Windows that supports right-to-left languages, this statement returns TRUE if the SingleLineEdit sle_name is composed entirely of Arabic characters:

IsAllArabic(sle_name.Text)

 

2, IsAllHebrew ()

Function: Determines whether a specified string consists entirely of Hebrew characters. This function is only available in the Hebrew version of PowerBuilder.

Hebrew(string)

Parameter: string: the string to be tested.

Return value: Boolean. The function returns TRUE if the content of the string consists entirely of Hebrew characters, FALSE otherwise. This function also returns FALSE if the string contains numbers, Spaces, and punctuation marks. This function always returns FALSE if PowerBuilder is not in Hebrew.

Example: Under a version of Windows that supports right-to-left languages, this statement returns TRUE if the SingleLineEdit sle_name is composed entirely of Hebrew characters:

IsAllHebrew(sle_name.Text)

 

3, IsAnyArabic ()

Function: Determines whether a specified string contains Arabic characters. This function is only available in Arabic version of PowerBuilder.

IsAnyArabic(string)

Parameter: string: the string to be tested.

Return value: Boolean. The function returns TRUE if the string contains at least one Arabic character, FALSE otherwise. This function always returns FALSE if PowerBuilder is not in Arabic.

Example: Under a version of Windows that supports right-to-left languages, this statement returns TRUE if the SingleLineEdit sle_name contains at least one Arabic character:

IsAnyArabic(sle_name.Text)

 

4, IsAnyHebrew ()

Function: Determines whether the specified string contains Hebrew characters. This function is only available in the Hebrew version of PowerBuilder.

IsAnyArabic(string)

Parameter: string: String to be tested Return value Boolean. The function returns TRUE if the string contains at least one Hebrew character, FALSE otherwise. This function always returns FALSE if PowerBuilder is not in Hebrew.

Example: Under a version of Windows that supports right-to-left languages, this statement returns TRUE if the SingleLineEdit sle_name contains at least one Hebrew character:

IsAnyHebrew(sle_name.Text)

 

5, IsArabic ()

Function: Checks whether the specified character is Arabic. If the parameter is a string, only the first character on the left is Arabic. This function is only available in the Arabic version of PowerBuilder.

Arabic: IsArabic (character)

Parameter: character: Character or string to test Return value Boolean. The function returns TRUE if character is an Arabic character, FALSE otherwise. This function always returns FALSE if PowerBuilder is not in Arabic.

Example: Under a version of Windows that supports right-to-left languages, this statement returns TRUE if the SingleLineEdit sle_name begins with an Arabic character:

IsArabic(sle_name.Text)

 

6, IsArabicAndNumbers ()

Function: Determines whether a specified string consists entirely of Arabic characters or numbers. This function is available only in the Arabic version of PowerBuilder.

Syntax: IsArabicAndNumbers (string)

Parameter: string: the string to be tested.

Return value: Boolean. The function returns TRUE if the string content consists entirely of Arabic characters or numbers, FALSE otherwise. This function always returns FALSE if PowerBuilder is not in Arabic.

Example: Under a version of Windows that supports right-to-left languages, this statement returns TRUE if the SingleLineEdit sle_name is composed entirely of Arabic characters and numbers:

IsArabicAndNumbers(sle_name.Text)

 

7, IsHebrew ()

Function: determines whether the specified character is a Hebrew character. If the parameter is a string, only the first character on the left is checked for Hebrew character. This function is only available in the Hebrew version of PowerBuilder.

Arabic: IsArabic (character)

Parameter: character: character or string to be tested.

Return value: Boolean. The function returns TRUE if character is a Hebrew character, FALSE otherwise. This function always returns FALSE if PowerBuilder is not in Hebrew.

Example: Under a version of Windows that supports right-to-left languages, this statement returns TRUE if the SingleLineEdit sle_name begins with a Hebrew character:

IsHebrew(sle_name.Text)

 

8, IsHebrewAndNumbers ()

Function: Determines whether a specified string consists entirely of Hebrew characters or numbers. This function is only available in the Hebrew version of PowerBuilder.

Syntax: IsArabicAndNumbers (string)

Parameter: string: the string to be tested.

Return value: Boolean. The function returns TRUE if the content of the string consists entirely of Hebrew characters or numbers, FALSE otherwise. This function always returns FALSE if PowerBuilder is not in Hebrew.

Example: Under a version of Windows that supports right-to-left languages, this statement returns TRUE if the SingleLineEdit sle_name is composed entirely of Hebrew characters and numbers:

IsHebrewAndNumbers(sle_name.Text)

 

9, Reverse ()

Function: Reverse character order in a string.

Syntax: Reverse (string)

Parameter: string: string to reverse character order.

Return value: String. The function returns the reversed string on success, or an empty string (“”) on error.

The method: Reverse() function places the last character in one string at the first character in another string, the penultimate character at the second character in another string, and so on.

Example: Under a a version of Windows that supports right-to-left languages, this statement returns a string with the characters in reverse order from the characters entered in sle_name:

string ls_name

ls_name = Reverse(sle_name.Text)

 

10, ToAnsi ()

Power: Convert Unicode characters to ANSI characters.

Syntax: ToAnsi (string)

Parameter: string: Unicode encoded string to be converted.

Return value: Blob. The function returns anSI-encoded BLOB data for the specified string on success, or null on error.

Example: This example converts a string into an ANSI blob using the ToAnsi function and then writes the blob to a file.

integer  li_filenum

blob     lblb_text

string   ls_native

ls_native = “Sample text in native format”

li_filenum = FileOpen(“ansi_out.txt”, StreamMode! ,Write! , LockWrite! , Replace!)

lblb_text = ToAnsi(ls_native)

FileWrite(li_filenum, lblb_text)

FileClose(li_filenum)

 

11, ToUnicode ()

Power: Convert ANSI characters to Unicode characters.

Language: ToUnicode(blob)

Parameter: BLOB: ANSI-encoded BLOB type data to be converted.

Return value: String. The function returns the Unicode encoded string for the specified string on success, and an empty string on error.

Example: This example illustrates the use of the ToUnicode function to convert a string entered in a MultilineEdit control into a Unicode blob:

blob  lblb_text

string  ls_native

ls_native = mle_entry.Text

lblb_text = ToUnicode(ls_native)

 

12, FromAnsi ()

Power: Convert Blob data containing ANSI strings to a string in PowerBuilder’s current version file format.

Language: FromAnsi (Blob)

Parameter: Blob: ANSI-encoded Blob type data to be converted.

Return value: String. The function returns a string in the current PowerBuilder version file format corresponding to the specified Blob data on success, or an empty string on error.

How to use it: If you are currently using a Unicode version of PowerBuilder, the FromAnsi() function converts the ANSI contained in the Blob to Unicode strings. If you are currently using an ANSI version of PowerBuilder, the FromAnsi() function converts the data in the Blob into a string. In the ANSI version of PowerBuilder, the result of the operation of the FromAnsi() function is the same as that of the String(Blob) function.

Example: This example reads a blob containing an ANSI character string from a file called ansi.txt and converts it into a string:

integer  li_filenum

blob  lb_text

string  ls_native, ls_dbg

li_filenum = FileOpen(“ansi.txt”, StreamMode!)

FileRead(li_filenum, lb_text)

ls_dbg = string(lb_text)

ls_native = FromAnsi(lb_text)

FileClose(li_filenum)


13, FromUnicode ()

Power: Converts Blob data containing Unicode strings to a string in PowerBuilder’s current version file format.

Language: FromUnicode (Blob)

Parameter: Blob: Unicode encoded Blob type data to be converted.

Return value: String. The function returns a string in the current PowerBuilder version file format corresponding to the specified Blob data on success, or an empty string on error.

How to use it: If you are using a Unicode version of PowerBuilder, the FromUnicode() function converts Unicode data contained in the Blob into Unicode strings. If you are currently using an ANSI version of PowerBuilder, the FromUnicode () function converts the data in the Blob to an ANSI string. In the Unicode version of PowerBuilder, the FromUnicode () function operates in the same way as the String(Blob) function.

Example: This example converts a Unicode blob that contains the definition of a PowerBuilder window into an ANSI string so that it can be imported into PowerBuilder.

integer li_fileone, li_filetwo

blob lb_text

string ls_native

li_fileone = FileOpen(“D:\tst\w_one.srw”, StreamMode!)

// Move the file pointer so that Unicode

// identifying characters aren’t copied

FileSeek(li_Fileone, 2)

// Read the data in the file into a blob

FileRead(li_fileone, lb_text)

FileClose(li_fileone)

// Convert the Unicode blob to a string

ls_native = FromUnicode(lb_text)

// Open a second file to copy the string to

li_filetwo = FileOpen(“w_one.srw”, StreamMode! , Write!)

FileWrite(li_filetwo, ls_native)

FileClose(li_filetwo)