-------------  类型换转函数  ------------- 函数     返回值类型                  功能                         例子        结果  ==================================================================================  Val(x)    Double        将数字字符串x转换为数值             2+Val("12")       14  Str(x)    string        将数值转为字符串,字符串首位表示符号 Str(5)            "空格5"  Asc(x)    Integer       求字符串中首字符的ASCLL码           asc("AB")         65  Chr(x)    string        将x转换为字符                       Chr(65)           "A"  cint(x)   integer       将x转为整型数,小数部分四舍五入      cint(1234.57)     1235  Clng(x)   Long          将x转为长整型数,小数部分四舍五入    Clng(325.3)       325  Csng(x)   Single        将x合入为单精度数                   Csng(56.5421117)  56.54211  Cdbl(x)   Double        将x转为双精度数                     Cdbl(1234.5678)   1234.5678  Ccur(x)   Currency      把x转换为货币型数,小数部分最多保留  Ccur(876.43216)   876.4322                          4位且自动四舍五入                    Cvar(x)   Variant       把x转换为变体型数                   Cvar(99&"00")     "9900"  Hex(x)    string        把十进制数x转换为十六进制数         Hex(31)           "1F"  Oct(x)    string        把十进制数x转换为八进制数           Oct(20)           "24"  ----------------  日期与时间函数  ----------------  函数     返回值类型             功能           例子             结果  ==================================================================================  Date         Date          返回系统日期         Date                 示例:11/03/2002  Time         Date          返回系统时间         Time                 示例:7:03:28  Now          Date          返回系统日期和时间   Now                  示例:11/03/2002 7:03:28  Day(日期)    integer       返回日数             Day(#2002/9/24#)      24  Month(日期)  integer       返回月份数           Month(#2002/9/24)     9  Year(日期)   integer       返回年度数           Year(#2002/9/24)      2002  Weekday(日期)integer       返回星期几           Weekday(#2002/9/24 #) 3  Hour(时间)   integer       返回小时数           Hour(#8:3:28 PM #)    20  Minute(时间) integer       返回分钟数           Minute(#8:3:28 PM #)  3  Second(时间) integer       返回秒数             Second(#8:3:28 PM #)  28   ------------  字符串函数  ------------     函数                  返回值类型                  功能                  例子            结果  ========================================================================================================  Len(字符串)           integer            字符串长度                  Len("ABCD")            4  Left(字符串,n)        String             取左边n个字符               Left("ABCD",3)          "ABC"  Right(字符串,n)       String             取右边n个字符               Righ("ABCD",3)          "ACD"  mid(字符串,p[,n]      String             从第p个开始取n个字符        Mid("ABCD",2,3)         "BCD"  Instr([f,]字符串1,字  Integer            求串2在串1出现的位置        Instr("ABabc","ab")     3  符串2[,k]  String(n,字符)        String             生成n个字符                 String(4,"*")           "****"        Space(n)              String             生成n个空格                 Space(5)                5个空格  Ltrim(字符串)         String             去掉左边空格                Ltrim("空格空格AB空格") "AB空格"  Rtrim(字符串)         String             去掉右边空格                Rtrim("空格空格AB空格") "空格空格AB"  Trim(字符串)          String             去掉左.右边空格             trim("空格空格AB空格")  "AB"  Lcase(字符串)         String             转成小写                    Lcase("Abab")           "abab"  Ucase(字符串)         String             转成大写                    Ucase("Abab")           "ABAB"  StrComp(字符串1,字符                     串1<串2  -1                   串2[,k])              Integer            串1=串2   0                 Strcomp("AB,"ABC")      -1                                           串1>串2   1  ------------------  常用数学函数  ------------------  函数     返回值类型             功能              例子             结果  ==================================================================================  Abs(x)   与x相同             x的绝对值              Abs(-4.6)         4.6  Sqr(x)   Double              x的平方根              Sqr(9)            3  Sin(x)   Double              x的正弦值              Sin(30*3.14/180)  0.499...  Cos(x)   Double              x的余弦值              Cos(60*3.14/180)  0.500...  Tab(x)   Double              x的正切值              tan(60*3.14/180)  1.729...  Atn(x)   Double              x的反正切              4*Atn(1)          3.14159...  Exp(x)   Double              e(自然数的底)的幂值    Exp(x)            e的x次方  Log(x)   Double              x的自然对数值          Log(x)/Log(10)    Log10次方  Int(x)   Double              取不大与x的最大整数    Int(99.8)         99                                                      Int(-99.8)        -100  Fix(x)   Double              取x的整数部分          Fix(99.8)         99                                                      Fix(-99.8)        -99  Sgn(x)   Integer             取x的符号              Sgn(5)            1                                                      Sgn(0)            0                                                      Sgn(-5)           -1  Rnd(x)   Single              产生0~1之间(不包括1)的 Rnd               随机数                               随机数      
|