欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    PB函数大全.docx

    • 资源ID:2910293       资源大小:86.12KB        全文页数:191页
    • 资源格式: DOCX        下载积分:3金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    PB函数大全.docx

    1、PB函数大全PB函数大全一、数组函数 1、LowerBound() 功 能:得到指定数组第n维的下界。 语 法:LowerBound ( array , n ) 参 数:array:数组名。 n:数值类型,可选项,指定要得到数组哪一维的下界。缺省值为1。 返回值:Long。函数执行成功时返回array数组第n维的下界。如果n的值超过了指定数组的最大维数,那么该函数返回-1。如果任何参数的值为NULL,LowerBound()函数返回NULL。 示 例:integer a5, b2,5 LowerBound(a) / Returns 1 LowerBound(a, 1) / Returns 1

    2、LowerBound(a, 2) / Returns -1, a has only 1 dim LowerBound(b, 2) / Returns 1 integer c LowerBound(c) / Returns 1 c50 = 900 LowerBound(c) / Returns 1 integer d-10 to 50 LowerBound(d) / Returns - 10 2、UpperBound() 功 能:得到指定数组第n维的上界。 语 法:UpperBound( array , n ) 参 数:array:数组名。 n:数值类型,可选项,指定要得到数组哪一维的上界。缺省

    3、值为1。 返回值:Long。函数执行成功时返回array数组第n维的上界。如果n的值超过了指定数组的最大维数,那么该函数返回-1。如果任何参数的值为NULL,UpperBound()函数返回NULL。 示 例:integer a5, b2,5 LowerBound(a) / Returns 1 LowerBound(a, 1) / Returns 1 LowerBound(a, 2) / Returns -1, a has only 1 dim LowerBound(b, 2) / Returns 1 integer c LowerBound(c) / Returns 1 c50 = 900

    4、LowerBound(c) / Returns 1 integer d-10 to 50 LowerBound(d) / Returns - 10 二、Blob(大二进制对象)函数 Blob函数得到Blob数据类型的信息、完成数据类型转换以及操作Blob类型数据。 1、Blob() 功 能:将字符串转换成Blob类型数据。 语 法:Blob ( text ) 参 数:text: string类型,指定要转换的数据。返回值:Blob。函数执行成功时返回转换后的Blob类型数据;如果text参数的值为NULL,则Blob()函数返回NULL。 示 例:Blob B B = Blob(“北京”) 2

    5、、BlobEdit() 功 能:将任意类型的数据插入到Blob类型变量的指定位置。 语 法:BlobEdit ( blobvariable, n, data ) 参 数:blobvariable:Blob类型的已初始化变量,将向该变量中插入数据。 n:指定插入位置,有效值在1到4,294,967,295之间。 data:要插入到Blob类型变量中的数据,其数据类型可以是任何有效的PowerBuilder数据类型。返回值:Unsigned long。函数执行成功时返回下次可以插入数据的位置;如果blobvariable变量中空间不够或任何参数的值为NULL,则BlobEdit()函数返回NULL

    6、。 示 例:下面的代码把一幅位图的数据复制到Blob类型变量emp_photo的起始位置,并把下次数据复制位置保存到变量nbr中,之后将当天的日期复制到emp_photo变量中位图数据的后面。 blob1000 emp_photo blob temp date pic_date ulong nbr . / Read BMP file containing employee picture . / into temp using FileOpen and FileRead. pic_date = Today() nbr = BlobEdit(emp_photo, 1, temp) BlobEdi

    7、t(emp_photo, nbr, pic_date) UPDATEBLOB Employee SET pic = :emp_photo WHERE . 3、BlobMid() 功 能:从Blob变量中提取出一段数据。提取之后,原Blob变量内容不变。 语 法:BlobMid ( data, n , length ) 参 数:data:Blob类型的数据。 n:指定要提取数据的起始位置,有效值在1到4,294,967,295之间。 length:可选项,指定要提取数据的长度,以字节为单位,有效值在1到4,294,967,295之间。缺省时提取从指定位置n到末尾的所有数据返回值:Blob。函数执

    8、行成功时返回指定字节数的数据。如果n的值大于data的字节数,函数返回空。如果n与length的和超过了data数据的字节数,那么BlobMid()函数返回剩下的数据,数据长度将小于参数length的值。如果任何参数的值为NULL,则BlobMid()函数返回NULL。 示 例:In this example, the first call to BlobMid stores 10 bytes of the blob datablob starting at position 5 in the blob data_1; the second call stores the bytes of d

    9、atablob from position 5 to the end in data_2: blob data_1, data_2, datablob . / Read a blob datatype into datablob. data_1 = BlobMid(datablob, 5, 10) data_2 = BlobMid(datablob, 5) This code copies a bitmap in the blob emp_photo starting at position 1, stores the position at which the next copy can b

    10、egin in nbr, and then copies a date into the blob emp_photo after the bitmap data. Then, using the dates start position, it extracts the date from the blob and displays it in the StaticText st_1: blob1000 emp_photo blob temp date pic_date ulong nbr . / Read BMP file containing employee picture . / i

    11、nto temp using FileOpen and FileRead. pic_date = Today() nbr = BlobEdit(emp_photo, 1, temp) BlobEdit(emp_photo, nbr, pic_date) st_1.Text = String(Date(BlobMid(emp_photo, nbr) 4、Len() 功 能:得到Blob类型变量的数据长度,以字节为单位。 语 法:Len ( blob ) 参 数:blob:Blob类型变量。返回值:Long。函数执行成功时返回blob变量的长度,发生错误时返回-1。如果任何参数的值为NULL,则L

    12、en()函数返回NULL。用 法:如果在说明Blob类型的变量时指定了变量长度,那么对该变量来说,Len()函数得到的就是这个指定的长度。如果在变量说明时未指定变量长度,那么PowerBuilder在赋值时调整长度,未赋值Blob类型变量的长度为0。 示 例:This statement returns 0: Len() These statements store in the variable s_address_len the length of the text in the SingleLineEdit sle_address: long s_address_len s_addres

    13、s_len = Len(sle_address.Text) The following scenarios illustrate how the declaration of blobs affects their length, as reported by Len. In the first example, an instance variable called ib_blob is declared but not initialized with a size. If you call Len before data is assigned to ib_blob, Len retur

    14、ns 0. After data is assigned, Len returns the blobs new length. The declaration of the instance variable is: blob ib_blob The sample code is: long ll_len ll_len = Len(ib_blob) / ll_len set to 0 ib_blob = Blob( Test String) ll_len = Len(ib_blob) / ll_len set to 11 In the second example, ib_blob is in

    15、itialized to the size 100 when it is declared. When you call Len for ib_blob, it always returns 100. This example uses BlobEdit, instead of Blob, to assign data to the blob because its size is already established. The declaration of the instance variable is: blob100 ib_blob The sample code is: long

    16、ll_len ll_len = Len(ib_blob) / ll_len set to 100 BlobEdit(ib_blob, 1, Test String) ll_len = Len(ib_blob) / ll_len set to 100 5、String()功 能:将Blob类型变量的值转换成字符串类型。如果Blob类型变量的值不是文本型数据,String()函数将其值解释成字符。 语 法:String ( blob ) 参 数:blob:要对其值进行类型转换的Blob类型变量。返回值:String。函数执行成功时返回转换后的数据,失败时返回空字符串()。如果blob变量中包含的数

    17、据不是字符串类型的数据,那么String()函数尽可能把数据解释为字符,并返回字符串类型数据。如果blob参数的值为NULL,则String()函数返回NULL。示 例:This example converts the blob instance variable ib_sblob, which contains string data, to a string and stores the result in sstr: string sstr sstr = String(ib_sblob) This example stores todays date and test status i

    18、nformation in the blob bb. Pos1 and pos2 store the beginning and end of the status text in the blob. Finally, BlobMid extracts a sub-blob that String converts to a string. Sle_status displays the returned status text: blob100 bb long pos1, pos2 string test_status date test_date test_date = Today() I

    19、F DayName(test_date) = Wednesday THEN test_status = Coolant Test IF DayName(test_date) = Thursday THEN test_status = Emissions Test / Store data in the blob pos1 = BlobEdit( bb, 1, test_date) pos2 = BlobEdit( bb, pos1, test_status ) . / Some processing / Extract the status stored in bb and display i

    20、t sle_status.text = String( BlobMid(bb, pos1, pos2 - pos1)三、数据类型检查和转换函数 1、Asc() 功 能:得到字符串第一个字符的ASCII码整数值。 语 法:Asc ( string ) 参 数:string:要得到第一个字符ASCII值的字符串。返回值:Integer。函数执行成功时返回string参数第一个字符的ASCII值,如果string参数的值为NULL,则Asc()函数返回NULL。 示 例:下面的语句返回66,即字母B的ASCII值。 Asc(B) 下面的代码检查字符串ls_name的第一个字母是否是大写字母。 IF

    21、Asc(ls_name) 64 and Asc(ls_name) 91 THEN 2、Char() 功 能:将字符串的第一个字符、Blob变量的第一个值、或一个整数转换成字符。 语 法:Char ( n ) 参 数:n:字符串、Blob变量或整数,也可以是包含上述类型数据的Any类型变量。 返回值:Char。返回参数n的第一个字符。如果n参数的值为NULL,则Char()函数返回NULL。 示 例:下面的代码ls_S的值设置为星号(*),对应于ASCII值42。 String ls_S ls_S = Char(42) 3、Dec() 功 能:将字符串或Blob值转换成Decimal类型的值。

    22、语 法:Dec ( stringorblob )参 数:stringorblob:string类型变量或Blob类型变量。Blob类型变量时,把该变量第一个值转换为 Decimal类型的值,其余部分被忽略。stringorblob参数也可以是包含上述类型数据的Any类型变量。返回值:Decimal。函数执行成功时返回相应的Decimal类型值。如果stringorblob参数中的值不是有效的PowerScript数字或数据类型不兼容,那么Dec()函数返回0。如果stringorblob参数的值为NULL,则Dec()函数返回NULL。 示 例:Dec(“24.3”) 4、Double() 功

    23、 能:将字符串或Blob值转换成Double类型的值。 语 法:Double(stringorblob)参 数:stringorblob:string类型变量或Blob类型变量。Blob类型变量时,把该变量第一个值转换为 Double类型的值,其余部分被忽略。stringorblob参数也可以是包含上述类型数据的Any类型变量。返回值:Double。函数执行成功时返回相应的Double类型值。如果stringorblob参数中的值不是有效的PowerScript数字或数据类型不兼容,那么Double()函数返回0。如果stringorblob参数的值为NULL,则Double()函数返回NUL

    24、L。 示 例:Double(“24.332”) 5、Integer() 功 能:将字符串或Blob值转换成Integer类型的值。 语 法:Integer ( stringorblob )参 数:stringorblob:string类型变量或Blob类型变量。Blob类型变量时,把该变量第一个值转换为 Integer类型的值,其余部分被忽略。stringorblob参数也可以是包含上述类型数据的Any类型变量。返回值:Integer。函数执行成功时返回相应的Integer类型值。如果stringorblob参数中的值不是有效的PowerScript数字或数据类型不兼容,那么Integer()

    25、函数返回0。如果stringorblob参数的值为NULL,则Integer()函数返回NULL。 示 例:下面的语句以Integer数据类型返回24。 Integer(“24.332”) 6、Long() 功 能:将其它类型的数据转换为Long类型的值。该函数有两种语法格式: 语法一、将两个无符号整数组合成一个长整数值; 语法二、将字符串或Blob值转换成Long类型的值。下面分别予以介绍: 语法一 、将两个无符号整数组合成一个长整数值 语 法:Long ( lowword, highword ) 参 数:lowword:UnsignedInteger类型,指定长整数中的低位值。 highw

    26、ord:UnsignedInteger类型,指定长整数中的高位值。返回值:Long。函数执行成功时返回由低位值和高位值组合后的长整数值,发生错误时返回-1。如果任何参数的值为NULL,则Long()函数返回NULL。 语法二、将字符串或Blob值转换成Long类型的值 语 法:Long ( stringorblob )参 数:stringorblob:string类型变量或Blob类型变量。Blob类型变量时,把该变量第一个值转换为Long类型的值,其余部分被忽略。stringorblob参数也可以是包含上述类型数据的Any类型变量。返回值:Long。函数执行成功时返回相应的Long类型值。如

    27、果stringorblob参数中的值不是有效的 PowerScript数字或数据类型不兼容,那么Long()函数返回0。如果stringorblob参数的值为NULL,则Long()函数返回NULL。 示 例:下面的语句以Long数据类型返回23458888。 Long(“23458888”) 7、Real() 功 能:将字符串或Blob值转换成Real类型的值。 语 法:Real ( stringorblob )参 数:stringorblob:string类型变量或Blob类型变量。当该参数是Blob类型变量时,把该变量第一个值转换为Real类型的值,其余部分被忽略。stringorblo

    28、b参数也可以是包含上述类型数据的Any类型变量。 返回值:Real。函数执行成功时返回相应的Real类型值。如果stringorblob参数中的值不是有效的 PowerScript数字或数据类型不兼容,那么Real()函数返回0。如果stringorblob参数的值为NULL,则Real()函数返回NULL。 示 例:下面的语句以Long数据类型返回2323.3222。 Real(“2323.3222”) 8、Date() 功 能:将其它类型的数据转换为Date类型的数据。该函数有三种语法格式: 语法一、将DateTime类型或第一个值是DateTime或Date的Blob值转换成Date类型

    29、的值; 语法二、将其值是个有效日期的字符串转换成Date类型的值; 语法三、将三个整数组合成一个日期。下面分别予以介绍: 语法一、将DateTime类型或第一个值是DateTime或Date的Blob值转换成Date类型的值 语 法:Date ( datetime )参 数:datetime:DateTime类型的值或第一个值是DateTime或Date的Blob类型的值。当该参数是Blob类型变量时,把该变量第一个值转换为Date类型的值,其余部分被忽略。datetime参数也可以是包含上述类型数据的Any类型变量。返回值:Date。函数执行成功时返回相应的Date类型值。如果datetim

    30、e参数中的值不是有效的PowerScript日期或数据类型不兼容,那么Date()函数返回1900-01-01。如果datetime参数的值为NULL,则Date()函数返回NULL。示 例:下面的语句从DateTime类型变量ldt_StartDateTime中提取日期值并保存在ld_StartDate变量中。 Date ld_StartDate ld_StartDate = Date(ldt_StartDateTime) 语法二、将其值是个有效日期的字符串转换成Date类型的值 语 法:Date ( string ) 参 数:string:string类型,其值包括一个有效的以字符串形式表

    31、示的日期(比如January 1, 1998或12-31-99),string参数也可以是包含字符串类型数据的Any类型变量。返回值:Date。函数执行成功时返回相应的Date类型值。如果string参数中的值不是有效的PowerScript日期或数据类型不兼容,那么Date()函数返回1900-01-01。如果string参数的值为NULL,则Date()函数返回NULL。 示 例:下面的语句把字符串形式表示的日期转换为日期类型的日期。 Date ld_date ld_date = Date(“2004-02-04”) 语法三、将三个表示年、月、日的整数组合成一个日期 语 法:Date ( year, month, day ) 参 数:year:integer类型,指定日期中的年份,用四位数字表示,从0到9999; month:integer类型,指定日期


    注意事项

    本文(PB函数大全.docx)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开