PowerBuilder 函数

配置文件 函数

函数 意义
ProfileString(filename, section, key, default) 读取 INI 文件 String 值内容,无法读取返回 default
ProfileInt(filename, section, key, default) 读取 INI 文件 Int 值内容, 同上
SetProfileString(filename, section, key, value) 设置 INI 文件 String 值内容
SetProfileInt(filename, section, key, value) 设置 INI 文件 Int 值内容

时间日期 函数

函数 意义
year( d ) 取年份
today() 取当前日期
time( s )  
secondsafter( t, t )  
second( t ) 取秒数
now() 取当前时间
minute( t ) 取分钟
min( #x for %s )  
month( d ) 取月份
hour( t ) 取小时
DateTime(date,time) 合并日期和时间
Date(datetime) 取出日期
Time(datetime) 取出时间
String ClassName(var) 取类名字符串
Int Len(string) 取字符串长度
Date Today() 取当前日期

类型转换 函数

函数 意义
integer( s )  
String string(var) 转为 String
Date Date(string) 转为 Date
Real Real(string) 转为 Real
Double Double(string) 转为 Double
Long Long(string) 转为 Long
Dec Dec(string) 转为 Dec

检测 函数

函数 意义
IsNumber(string) 是否数值
IsDate(string) 是否日期
isTime(string) 是否时间
isTime( s )  
isSelected()  
isRowNew()  
isRowModified()  
isNumber( s )  
isDate( s )  
IsNull(var) 是否空值

窗口函数

函数 意义
MessageBox(title, text [,icon [,button [,default]]]) 显示对话框
Open(win_name) 打开窗口
Close(win_name) 关闭窗口
CloseWithReturn(win_name,return_value) 关闭窗口并且返回一个值,返回值在 Message 对象
Run(program [,state]) 运行外部程序,支持扩展名 EXE、COM、BAT。

state 表明窗口类型 Normal!、Minimized!、Maxmized!

RGB(red,green,blue) 生成颜色值
ASC(string) 返回首字符 ASCII 值

数学函数

函数 意义
wordcap( s )  
varp( #x for %s )  
var( #x for %s )  
truncate( x, y )  
tan( x ) 正切
sum( #x for %s )  
string( x, s )  
stdevp( #x for %s )  
stdev( #x for %s )  
sqrt( x ) 平方根
small( #x, #x, n for %s )  
sin( x ) 正弦
sign( x ) 正符号
rowheight()  
rowcount()  
round( x, x ) 四舍五入
rightTrim( s )  
rgb( r, g, b) 生成颜色值
relativetime( t, x )  
relativedate( d, x )  
real( s )  
rand( x ) 随机数
pos( s, s, x )  
pi( x )  
percent( #x for %s)  
pageCountAcross()  
pageAcross()  
pageCount()  
page()  
number( s )  
mode( #x for %s )  
mod( x, y ) 取模运算
median( #x for %s )  
max( #x for %s )  
lookupdisplay( #x )  
logten( x )  
log( x ) 自然对数
last( #x for %s )  
large( #x, #x, n for %s )  
int( x ) 取整
if( b, t, f ) 条件语句
gettext()  
getrow()  
first( #x for %s )  
fill  

字符串函数

函数 意义
upper( s ) 字符串转大写
trim( s ) 去字符串尾空格
space( x ) 生成由空格组成的字符串
right( s, n ) 取字符串右侧子串
replace( s, x, y, s ) 字符串替换
mid( s, start, len ) 取字符串中间子串
len( s ) 取字符串长度值
lower( s ) 字符串转小写
leftTrim( s ) 去字符串左空
left( s, n ) 取字符串左侧子串
lastpos( s, s, x ) 取子字符串最后位置
match(string,string) 匹配字符串,参见 匹配模式字符含义

匹配模式字符(类似正则表达式)

字符 意义
^ 开头位置
$ 结尾位置
[] 字符组 [abc]
- 连字符 [a-z]
* 0 或任意次匹配
+ 1 或任意次匹配
0 或 1 次匹配
\ 转义字符,\$