八、国际化函数

八、国际化函数

1、IsAllArabic()

功  能:确定指定的字符串是否全部由阿拉伯文字符组成,该函数只能在PowerBuilder的阿拉伯文版本中使用。

语  法:IsAllArabic ( string )

参  数:string:要测试的字符串。

返回值:Boolean。如果string的内容全部由阿拉伯文字符组成,那么函数返回TRUE,否则返回FALSE。字符串中如果包含数字、空格、标点符号,那么该函数也返回FALSE。如果PowerBuilder不是阿拉伯文版本,该函数总是返回FALSE。

示  例: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()

功  能:确定指定的字符串是否全部由希伯来文字符组成,该函数只能在PowerBuilder的希伯来文版本中使用。

语  法:IsAllHebrew( string )

参  数:string:要测试的字符串。

返回值:Boolean。如果string的内容全部由希伯来文字符组成,那么函数返回TRUE,否则返回FALSE。字符串中如果包含数字、空格、标点符号,那么该函数也返回FALSE。如果PowerBuilder不是希伯来文版本,该函数总是返回FALSE。

示  例: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()

功  能:确定指定的字符串中是否包含阿拉伯文字符,该函数只能在PowerBuilder的阿拉伯文版本中使用。

语  法:IsAnyArabic( string )

参  数:string:要测试的字符串。

返回值:Boolean。如果string中至少包含一个阿拉伯文字符成,那么函数返回TRUE,否则返回FALSE。如果PowerBuilder不是阿拉伯文版本,该函数总是返回FALSE。

示  例: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()

功  能:确定指定的字符串中是否包含希伯来文字符,该函数只能在PowerBuilder的希伯来文版本中使用。

语  法:IsAnyArabic( string )

参  数:string:要测试的字符串返回值 Boolean。如果string中至少包含一个希伯来文字符,那么函数返回TRUE,否则返回FALSE。如果PowerBuilder不是希伯来文版本,该函数总是返回FALSE。

示  例: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()

功  能:确定指定的字符是否是阿拉伯文字符,如果参数为字符串,则只检查左边第一个字符是否是阿拉伯文字符。该函数只能在PowerBuilder的阿拉伯文版本中使用。

语  法:IsArabic ( character )

参  数:character:要测试的字符或字符串返回值Boolean。如果character是阿拉伯文字符,那么函数返回TRUE,否则返回FALSE。如果PowerBuilder不是阿拉伯文版本,该函数总是返回FALSE。

示  例: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()

功  能:确定指定的字符串是否全部由阿拉伯文字符或数字组成,该函数只能在PowerBuilder的阿拉伯文版本中使用。

语  法:IsArabicAndNumbers ( string )

参  数:string:要测试的字符串。

返回值:Boolean。如果string的内容全部由阿拉伯文字符或数字组成,那么函数返回TRUE,否则返回FALSE。如果PowerBuilder不是阿拉伯文版本,该函数总是返回FALSE。

示  例: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()

功  能:确定指定的字符是否是希伯来文字符,如果参数为字符串,则只检查左边第一个字符是否是希伯来文字符。该函数只能在PowerBuilder的希伯来文版本中使用。

语  法:IsArabic ( character )

参  数:character:要测试的字符或字符串。

返回值:Boolean。如果character是希伯来文字符,那么函数返回TRUE,否则返回FALSE。如果PowerBuilder不是希伯来文版本,该函数总是返回FALSE。

示  例: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()

功  能:确定指定的字符串是否全部由希伯来文字符或数字组成,该函数只能在PowerBuilder的希伯来文版本中使用。

语  法:IsArabicAndNumbers ( string )

参  数:string:要测试的字符串。

返回值:Boolean。如果string的内容全部由希伯来文字符或数字组成,那么函数返回TRUE,否则返回FALSE。如果PowerBuilder不是希伯来文版本,该函数总是返回FALSE。

示  例: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()

功  能:颠倒字符串中字符次序。

语  法:Reverse ( string )

参  数:string:要颠倒字符次序的字符串。

返回值:String。函数执行成功时返回颠倒字符次序后的字符串,如果发生错误,那么返回空字符串("")。

用  法:Reverse()函数将一个字符串中最后一个字符放置到另一个字符串的第一个字符位置、倒数第二个字符放置在另一个字符串的第二个字符位置,以此类推。

示  例: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()

功  能:将Unicode字符转换成ANSI字符。

语  法:ToAnsi ( string )

参  数:string:要进行转换的Unicode编码的字符串。

返回值:Blob。函数执行成功时返回指定字符串对应的ANSI编码的blob类型数据,发生错误时返回空值。

示  例: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()

功  能:将ANSI字符转换成Unicode字符。

语  法:ToUnicode( blob)

参  数:blob:要进行转换的ANSI编码的blob类型数据。

返回值:String。函数执行成功时返回指定字符串对应的Unicode编码的字符串,发生错误时返回空字符串。

示  例: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()

功  能:将包含ANSI字符串的Blob数据转换成PowerBuilder当前版本文件格式的字符串。

语  法:FromAnsi ( Blob )

参  数:Blob:要进行转换的ANSI编码的blob类型数据。

返回值:String。函数执行成功时返回指定Blob类型数据对应的PowerBuilder当前版本文件格式的字符串,发生错误时返回空字符串。

用  法:如果你现在使用的是Unicode版本的PowerBuilder,那么FromAnsi()函数把Blob中包含的ANSI中转换成Unicode字符串;如果你现在使用的是ANSI版本的PowerBuilder,那么FromAnsi()函数把Blob中的数据转换成字符串。在ANSI版本的PowerBuilder中,FromAnsi()函数的操作结果与String(Blob)函数的操作结果相同。

示  例: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()

功  能:将包含Unicode字符串的Blob数据转换成PowerBuilder当前版本文件格式的字符串。

语  法:FromUnicode ( Blob )

参  数:Blob:要进行转换的Unicode编码的blob类型数据。

返回值:String。函数执行成功时返回指定Blob类型数据对应的PowerBuilder当前版本文件格式的字符串,发生错误时返回空字符串。

用  法:如果你现在使用的是Unicode版本的PowerBuilder,那么FromUnicode()函数把Blob中包含的Unicode数据转换成Unicode字符串;如果你现在使用的是ANSI版本的PowerBuilder,那么FromUnicode ()函数把Blob中的数据转换成ANSI字符串。在Unicode版本的PowerBuilder中,FromUnicode ()函数的操作结果与String(Blob)函数的操作结果相同。

示  例: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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值