VFP常用函数

合集下载

VFP常用函数总汇

VFP常用函数总汇

VFP常用函数总汇VFP常用函数总汇VFP常用函数使用说明1、数值运算函数函数操作例结果SQRT(x) 求平方根 SQRT(9) 3INT(x) 取整数 INT(3.14) 3ROUND(x) 四舍五入 ROUND(3.14159,4) 3.1416MOD(x,y) 求X除以Y的余数 MOD(25,4) 1MAX(x,y) 求X,Y中的最大值 MAX(7,8) 8MIN(x,y) 求X,Y中的最小值 MIN(1,2,3) 12、字符中操作函数函数名操作例结果UPPER(S)小写字母 UPPER(abc) ABCLOWER(S)大写字母 LOWER(ACD) acdLEN(S)求字符串的长度 LEN("中国1号") 7AT(S1,S2)在字符串S2,找字符串S1 AT("H","CHINA") 2SUBSTR(S,I,N)在S字符串中的第I个字符起取N个字符SUBSTR('TECHNOLO',3,3) CHNLEFT(S,N)从字符串S左边取N个字符 LEFT(“中国人”,4)中国RIGHT(S,N)从字符串S右边取N个字符S=‘12345’RIGHT(S,3) 345SPACE(N)生成N个空格 "合计"+SPACE(2)+"123" 合计123 TRIM(S)消除字符串尾部空格 TRIM("姓名 ") 姓名ALLTRI(S)消除字符串中所有空格 ALLTRIM("李丽")李丽STUFF(S1,N1,N2,S2) 用字符串S2替换S1中第N1个字符起的N2个字符 STUFF("NOW",2,1,"E") NEW& 宏替换P=“G2”USE &P USE G23、日期和时间函数函数名操作例结果DATE()求当前日期 DATE() 2001/11/12DATETIME() 求当前日期和时间 DATETIME() 2001/11/12/0:22:33amYEAR(D)求年份 YEAR(DATE()) 2001MONTH(D)求月份(数值) MONTH(DATETIME()) 11CMONTH(D)求月份(字符)MONTH(DATETIME()) NovenberDAY(D)求日期 DAY(DATE()) 12DOW(D)求星期几(数值) DOW(DATE()) 1CDOW(D)求星期几(英文) CDOW(DATE()) sundayTIME(D)求当前时间 TIME(DATE()) 10:20:38am4、数据类型转换函数函数名操作例结果ASC(S)求第一个字符串的ASCII码 ASC("what") 87CHR(N)求ASCII码的字符 CHR(87) wSTR(R,L,D) 数值转换成字符,L为长度,D为小数位数 X=3.1415STR(X,6,2) 3.14VAL(S)字符串转换为数值 VAL("123") 123.00CTOD(S)字符串转日期 CTOD('11/01/2002') 11/01/2002DTOC(D)日期转换成字符串 DTOC(DATE()) 11/01/2002DTOS(D)把日期转成年月日式的字符串DTOS(DATE()) 20021101CTOT(C)字符串转成日期时间型CTOT(11/01/2002 10:30:50am) 11/01/2002 10:30:50amDTOT(D)日期型转为日期时间型DTOT(DATE()) 11/25/2001 00:00:01amTTOC(T)日期时间型转为字符型TTOC(DATETIME()) 11/25/2001 00:00:01amTTOD(T)日期时间型转为日期型TTOD(DATETIME()) 11/25/2001IIF(LE,E1,E2) 逻辑判断 IIF(A>0,"YES","NO") YES5、检测函数函数名操作例结果RECNO()检测当前记录号 RECNO() 1RECCOUNT()检测当前记录数 RECCOUNT() 12BOF()开始记录 BOF() 1EOF()最后记录 EOF() 12FOUND()返回查找结果 FOUND() .T.ROW()返回当前行坐标 ROW() 1COL()返回当前列坐标 COL() 1SYS(N)返回系统状态 SYS(13)联机状态。

vfp常用函数汇总表

vfp常用函数汇总表

Visual FoxPro常用函数汇总表函数分类1、数学函数函数用途ABS(<数值表达式>)绝对值,|x|CEILING(<数值表达式>) >=自变量的最小整数EXP(<数值表达式>)对基E的幂,e=2.71828 FLOOR(<数值表达式>) <=自变量的最大整数INT(<数值表达式>)取整(舍尾)自变量LOG(<数值表达式>)自变量的自然对数,ln x LOG10(<数值表达式>)自变量的普通对数,lg x MAX(<表达式1>,<表达式2>)两个值的最大值MIN(<表达式1>,<表达式2>)两个值的最小值MOD(<数值表达式1>,<数值表达式2>)求余数RAND([<数值表达式1>])返回伪随机数ROUND(<数值表达式1>,<数值表达式2>)四舍五入第一个自变量SIGN(<数值表达式>)自变量的符号SQRT(<数值表达式>)平方根(正根)2、字符串操作函数函数用途&<内存变量> 用于代替内存变量内容LEN(<字符串表达式>)返回字符串表达式的字符个数SPACE(<数值表达式>)生成空格SUBSTR(<字符串表达式>,<数值表达式n>[,<数值表达式L>])求子字符串,从指定的字符串表达式第n个开始,总长为L的字符串LOWER(<字符串表达式>)将字符串字母转换成小写字母UPPER(<字符串表达式>)将字符串字母转换成大写字母TRIM(<字符串表达式>)删除字符串尾空格ASC(<字符串表达式>)返回字符串表达式最左边的第一个字符的ASCII码CHR(<数值表达式>)将数值表达式转换成字符AT(<字符串表达式1>,<字符串表达式2>[,<数值表达式n>])确定字符串表达式1在字符串表达式2中的位置,n为字符串表达式第几次出现STR(<数值表达式>[,<数值表达式L>][,<数值表达式n>)将数值转换为字符串,L为数值表达式总长,n为小数位数VAL(<字符串表达式>)将数字字符串转换为数字TYPE(<表达式>)检测表达式值的数据类型LTRIM(<字符串表达式>)删除字符串左部空格RTRIM(<字符串表达式>)删除字符串右部空格LEFT(<字符串表达式>,<数值表达式n>)取字符串左边部分字符,n为返回的字符个数RIGHT(<字符串表达式>,<数值表达式n>)取字符串右边部分字符,n从右边截取字符个数3、表(.dbf)操作函数函数用途BOF([<工作区号或别名>])查表文件开始函数EOF([<工作区号或别名>])表文件结尾测试函数RECNO([<工作区号或别名>])测试当前或指定工作区表的当前记录号DELETED([<工作区号或别名>])记录删除测试函数FILE(<"字符串">)测试文件是否存在函数DBF([<工作区号或别名>])检测表的文件名函数4、日期、时间函数函数用途DATE()查系统当前日期函数TIME([<数值表达式>])查系统当前时间函数YEAR(<日期型表达式>|<日期时间型表达式>)由日期查年函数MONTH(<日期型表达式>|<日期时间型表达式>)从日期查月份函数CMONTH(<日期型表达式>|<日期时间型表达式>)由日期查月份名函数DAY(<日期型表达式>|<日期时间型表达式>)从日期查当月的日函数DOW(<日期型表达式>|<日期时间型表达式>[,<数值表达式>])由日期查星期函数CDOW(<日期型表达式>|<日期时间型表达式>)从日期查星期名函数DTOC(<日期型表达式>|<日期时间型表达式>)日期转换为字符函数CTOD(<字符串表达式>)字符串转换为日期函数CTOT(<字符串表达式>)返回日期时间值函数TTOC(<日期时间型表达式>)返回字符值5、显示、打印位置函数函数用途ROW()判断光标行位置函数COL()判断光标列位置函数INKEY([<数值表达式>])检测用户所击键对应的ASCII码函数,数值表达式以秒为单位等待击键的时间6、其他函数函数用途DISKSPACE()返回默认磁盘驱动器中可用字节数函数OS()检测操作系统名称的函数VERSION()返回VFP版本号的函数。

VFP_函数

VFP_函数

数值函数1、INT函数(取整函数)格式:INT(数值表达式) 功能:求数值表达式值的整数部分。

例如:int(-18.567)的返回值为–18 int(-18.123) 的返回值亦为–182、MAX函数格式:MAX(表达式1,表达式2,…,表达式n)功能:求n个表达式中的最大值。

例如:a=2 b=15 c=9 时max(a,b,c) 的返回值为15a=’辽河’b=”淮河” c=[湘江] 时max(a,b,c,) 的返回值为湘江a= {^1997-07-01} b={^2001-12-20} c={^2001-07-13} 时max(a,b,c) 的返回值为07/13/01相似函数:MIN(表达式1,表达式2…表达式n),求n个表达式中的最小值。

3、MOD函数(取余函数)格式:MOD(数值表达式1,数值表达式2)功能:求数值表达式1除以数值表达式2的余数。

与运算符”%”的功能完全相同。

说明:数值表达式2不为0;大于0时函数返回正数;小于0时函数返回负数。

当两数值表达式的数值正负相异时,返回值为“余数+数值表达式2”例如:mod(18,5) 返回值 3 mod(-18,-5) 返回值-3 mod(18,-5) 返回值-2 (20-2)/(-5)==(-4)…(-2)mod(-18,5) 返回值 2 (-20+2)/5==(-4) (2)字符型函数1. & (宏替换)宏替换是FoxPro中一个非常重要的功能;从形式上看,&不象一个函数,更象一个运算符。

格式:&内存变量名[.字符表达式]功能:把字符型内存变量的当前值替换到&函数出现的位置上注意:圆点表示接在内存变量当前值的尾部如:在命令窗口依次执行下列命令:cc=’科技’ && 为字符型内存变量cc赋值’科技’bb=’&cc.大学’&& 为字符型内存变量bb赋值’科技大学’aa=’中国北京&bb’&& 为字符型内存变量aa 赋值? aa && 屏幕上显示aa的内容: 中国北京科技大学假设X=1Y=2Z=[X+Y]? &Z 输出结果为 32. LEN函数格式:LEN(字符表达式)功能:返回字符表达式中字符串的长度,若为空串,返回数值0。

vfp表常用函数

vfp表常用函数

vfp表常用函数基本操作:1、新建数据库命令:CREATE <文件名>2、打开数据库命令:USE <文件名>3、浏览数据库命令:BROWSE4、查找记录命令:LOCATE 例:Loca all for 性别=’女’Loca all for 工资>160.00 .AND. 工资<180.00常和继续查找命令CONTINUE连用。

FIND 例:find <字符串>/使用前需要先排序。

SEEK 例:seek <表达式>表达式是字符串时,必须用“”引起来。

如seek “卫明”5、增加库记录命令:APPEND &&增加记录命令APPEND BLANK &&增加一条空记录APPEND FROM <文件名> [FOR<表达式>] &&从一个文件复制记录到现行数据库中6、插入记录命令INSERT格式:insert [blank] [before]use <文件名>go 5insert before7、库记录的删除DELETE格式:DELETE [<范围>] [FOR<表达式>] [WHILE<表达式>]功能:给符合条件的库记录加上删除标记。

例:delete all for 性别=’女’PACK格式:PACK功能;把打开的数据库文件中作过删除标记的记录真正删除掉。

ZAP格式:ZAP功能;从打开的数据库文件中删除所有记录8、恢复命令RECALL格式;RECALL [<范围>] [FOR<表达式>] [WHILE<表达式>]功能;恢复打开的数据库文件中带有删除标记的记录9、库记录的修改EDIT格式:EDIT [<范围>] [FIELDS<字段名表>] [FOR<表达式>] [WHILE<表达式>]CHANGE格式:CHANGE [<范围>] [FIELDS<字段名>] [FOR<表达式>] [WHILE<表达式>]BROWSE格式:BROWSE [FIELDS<字段名>] [LOCK<表达式>] [FREEZE<字段名>]10、替换命令REPLACE格式;REPLACE [<范围>] <字段名1> WITH <表达式1> [,<字段名2> WITH<表达式2>…] [FOR<表达式>] [WHILE<表达式>]功能:用来替换打开的数据库文件中指定字段的数据。

VFP函数大全

VFP函数大全

VFP函数大全VFP函数大全%运算符用于计算并返回两个数值表达式相除之后的余数$(包含)运算符用于进行字符表达式之间的包含关系运算,如果一个字符表达式包含在另一个字符表达式之中,则函数返回真ABS() 计算并返回指定数值表达式的绝对值ACLASS() 用于将一个对象的父类名放置于一个内存数组中ACOPY() 把一个数组的元素拷贝到另一个数组中ACOS() 计算并返回一个指定数值表达式的余弦值ADATABASES() 用于将所有打开的数据库名和它的路径存入一个内在变量数组中ADB OBJECT S() 用于把当前数据库中的连接、表或SQL视图的名存入内存变量数组中ADEL() 用于从一维数据中删除一个元素,或从二维数组中删除一行或者一列元素ADIR() 将文件的有关信息存入指定的数组中,然后返回文件数AELEMENT() 通过元素的下标,返回元素号AFIELDS 将当前的结构信息存入数组中,然后返回表中的字段数AFONT() 将可用字体的信息存入数组中AERROR() 用于创建包含VFP或ODBC错误信息的内存变量AINS() 在一维数组中插入一个元素或在二维数组中插入一行或一列元素AINSTANCE() 用于将类的所有实例存入内存变量数组中,然后返回数组中存放的实例数ALEN() 返回数组中元素、行或者列数ALIAS() 返回当前工作区或指定工作区内表的别名ALLTRIM() 从指定字符表达式的首尾两端删除前导和尾随的空格字符,然后返回截去空格后的字符串AMEMBERS() 用于将对象的属性、过程和成员对象存入内存变量数组中ANSITOOEM() 将指定字符表达式中的每个字符转换为MS-DOS (OEM)字符集中对应字符APRINTERS() 将Print Manager中安装的当前打印机名存入内存变量数组中ASC() 用于返回指定字符表达式中最左字符的ASCII码值ASCAN() 搜索一个指定的数组,寻找一个与表达式中数据和数据类型相同的数组元素ASELOBJ() 将活动的Form设计器当前控件的对象引用存储到内存变量数组中ASIN() 计算并返回指定数值表达式反正弦值ASORT() 按升序或降序排列数组中的元素ASUBSCRIPT() 计算并返回指定元素号的行或者列坐标AT() 寻找字符串或备注字段在另一字符串或备注字段中的第一次出现,并返回位置ATAN() 计算并返回指定数值表达式的反正切值ATC() 寻找字符串或备注字段中的第一次出现,并返回位置,将不考虑表达式中字母的大小写ATCLINE() 寻找并返回一个字符串表达式或备注字段在另一字符表达式或备注字段中第一次出现的行号。

vfp函数大全(VFPfunctionDaquan)

vfp函数大全(VFPfunctionDaquan)

vfp函数大全(VFP function Daquan)Visual foxpro数据库函数Adatabases () 将所有打开数据库的名称和路径放到内存变量数组中Adbobjects () 把当前数据库中的命名连接名、关系名、表名或sql 视图名放到一个内存变量数组中Afields () 把当前表的结构信息存放在一个数组中, 并且返回表的字段数返回当前表或指定工作区衰的别名 (alias)Asessions () 创建一个已存在的数据工作期id数组Ataginfo () 创建一个包含索引和键表达式的名字、数量和类型信息的数组Aused () 将一个数据工作期中的表别名和工作区存入内存变量数组确定当前记录指针是否在表头 BOF ()判断索引是否为候选索引 (candidate)根据指定的索引位置编号 (CDX), 返回打开的复合索引 (CDX) 文件名称Cpdbp () 返回一个打开表所使用的代码页Createoffline () 由已存在的视图创建一个游离视图Cursorgetprop () 返回visualfoxpro表或临时表的当前属性设置Cursorsetprop () 指定visualfoxpro表或临时表的属性设置Cursortoxml () 转换visualfoxpro临时表为xml文本从磁盘上的表或远程数据源中直接返回字段值 Curval ()返回当前数据库的名称和路径 (DBC)返回指定工作区中打开的表名 (DBF), 或根据表别名返回表名Dbsetprop () 给当前数据库或当前数据库中的字段、命名连接、表或视图设置一个属性返回一个表明当前记录是否标有删除标记的逻辑值 (deleted)是否用descending关键字创建了一个索引标识 (Descending)Dropoffline () 放弃对游离视图的所有修改, 并把游离视图放回到数据库中确定记录指针位置是否超出当前表或指定表中的最后一个记录 EOF ()Fcount () 返回衰中的字段数目根据编号返回表中的字段名 (FIELD)返回setfilter命令中指定的表筛选表达式 (Filter)Fldlist () 对于setmelds命令指定的字段列表, 返回其中的字段和计算结果字段表达式尝试锁定当前表或指定表 flock ()For 返回一个己打开的单项索引文件或索引标识的索引筛选表达式()如果continue、find、locate或seek命令执行成功 found (), 函数的返回值为 "真"(以字节为单位, 返回指定字段或文件的大小 fsize)Getfldstate () 返回一个数值, 标明表或临时表中的字段是否已被编辑, 或是否有追加的记录, 或者记录的删除状态是否已更改Getnextmodified () 返回一个记录号, 对应于缓冲表或临时表中下一个被修改的记录返回当前或指定表文件的表头所占的字节数 (header)(IDXCOLLATE) sequence returns the index or index mark(INDBC) if the specified database object in the current database, returns true (.T.)(INDEXSEEK) in search of a record first appeared in an indexed table(ISEXCLUSIVE) to determine whether a table or database is openin exclusive mode(ISFLOCKED) return to the locked table(ISREADONLY) to determine whether the table open in read-only mode(ISRLOCKED) locked return records(KEY) index keyword expression returns the index mark or index file(KEYMATCH) search a keyword index in the index or index file(LOOKUP) the search field value with the specified expression, the first record in the tableLUPDATE () returns a date table last updatedMDX (.CDX) according to the composite index file number specified index return open nameMEMLINES () returns the number of rows in the memo fieldMLINE () returns the specified row in the memo field in string formNDX () returns for the current table or an index table to open the specified file name (JDX)ORDER () returns the current table or the specified table masterindex file or logo(PRIMARY) check index, if the main index, it returns "true" (.T.)RECCOUNT () returns the specified number or record in the tableRECNO () returns the current table or specify the current record number in the tableRECSIZE () returns the size for the record in the table (width)(REFRESH) refresh the data in the SQL view can be updated inRELATION () returns the expression specified for a given open workspace in the table(SEEK) in an indexed table in the search for the first time the position of a record(SELECT) the maximum number returned number or use the current workspace workspace(SETFLDSTATE) for a table or a temporary table in the field or record the specified field state value or delete state value(SQLCANCEL) request to cancel an executing SQL statements(SQLCOLUMNS) to specify the data source table column name and information on each column is stored in a temporary table in VisualFoxPro(SQLCOMMIT) submitted a transaction(SQLCONNECT) to establish a connection to the data source(SQLDISCONNECT) to terminate the connection with the data source(SQLEXEC) will be sent to a SQL statement in the source data processing(SQLGETPROP) returns an active connection the current settings or default settings(SQLMORERESULTS) if there is more than one set of results, will be another set of results copied to a temporary table in VisualFoxPro(SQLPREPARE) in the use of SQLEXEC () to perform remote data before operation, you can use this function to make the remote data ready for the command to execute(SQLROLLBACK) cancel any changes made during the current transaction(SQLSETPROP) specify a set of active connections(SQLSTRINGCONNECT) connection using a connection string and a data source(SQLTABLES) the data source table name stored in the temporarytable in VisualFoxProSYS (14) index expressionSYS (21) control index numberSYS (22) to control the name or index nameSYS (2011) returns the current workspace or record locking table locking stateSYS (2012) returns the memo field block size tableSYS (2021) screening indexSYS (2029) and returns the value corresponding to the table typeSYS (3054) Rushmore - grade optimizationTAG (.CDX) name returns the number of composite index file open, or return to the open.IDX index file nameTAGCOUNT (return) composite index file (.CDX) logo and open index file (.IDX) numberTAGNO (return) composite index file (.CDX) identification and open index (.IDX) index file(TARGET) returns a table alias, the table is specified in the INTO clause SETRELATION command relationship goals(UNIQUE) is used to test whether the only way to establish the index(UPDATED) for testing in recent READ commands, whether the data has been modified(USED) to determine whether the specified workspace opens a tableXMLTOCURSOR (XML) convert text to VisualFoxPro cursor or table----------------------------------------------Visual FoxPro date and time functions(CTOD) the character expressions into expressions date.(CDOW) returns a value from a given week date or date time expression.(CMONTH) the name of the month returns a date or a date time expressions.(CTOD) the character expressions into expressions date.CTOT () returns a date time value from a character expression.(DATE) returned by the date of the current system operating system controls, or create a compatible with the 2000 date value.(DATETIME) to date and time value returns the current date and time, or create a 2000 compatible date time value.(DAY) to return to a given date or numeric expression date and time expressions are the first few days.(DMY) a character expression from a date or date and time expression returns a "day month year" format (for example, 31 May 1995). Not abbreviated month name.(DTOC) returned by the date or the date and time expression character date.DTOS (string) returns yyyymmdd date format from the specified date or date and time in the expression.(DTOT) the return date time value from the date.(GOMONTH) for a given date or date and time expressions expressions, before or after the date of the month returns the specified number.(HOUR) return date and time expressions part hours.MDY () returns the specified date or date and time expressions to "month day year" format, which is abbreviated month name.(MINUTE) some minutes to return to date and time in the expression of type.MONTH () returns the date or date and time expressions in thevalue.QUARTER () returns a date or date and time expressions in quarter value.(SEC) part second to return to date and time in the expression of type.(SECONDS) in seconds since midnight after the return time.SYS (1) returns the current system date to date number string.SYS (2) returned since the start of the midnight time, in seconds.SYS (10) (Julian) the date will be converted into a string.SYS (11) the date format date expressions or string converted to date (Julian).(TIME) for 24 hours, the 8 string (hours: Minutes: seconds) returns the current system date and time format.(TTOC) returns a character value from the date and time expressions.TTOD () returns a date value from the date and time.WEEK () returns a value representative of the year the first few weeks from the date or date and time expressions in expression.YEAR () returns the year from the date specified in the.Visual FoxPro character function(ALLTRIM). Delete the specified character expression spaces before and afterASC () returns the leftmost characters in a character expression value of ANSIAT (return) first appeared in another character expression or memo field of a character expression or memo field locationAT_C (return) first appeared in another character expression or memo field of a character expression or memo field locationATC (return) first appeared in another character expression or memo field of a character expression or memo field locationATCC (return) first appeared in another character expression or memo field of a character expression or memo field location(ADDBS) if necessary, add a backslash to a path expressionATCLINE () returns the line number first appeared in another character expression or memo field a character expression or memo field.ATLINE () returns the line number first appeared in another character expression or memo field a character expression ormemo field.(BETWEEN) to determine the value of an expression is in between the other two expressions of the same data type valueCHR (ANSI) according to the numerical code specified the corresponding character(CHRTRAN) will replace the first character in the expression and the second expression character matching character for the corresponding character in the third expression(CHRTRANC) will replace the first character in the expression and the second expression character matching character for the corresponding character in the third expression(CPCONVERT) the character, character expression or memo field conversion to other code page(CHRSAW) to determine whether a character appears in the keyboard buffer(CHRTRAN) in a character expression, to replace the second match the expression character for the corresponding character in the third expression(CHRTRANC) will replace the first character in the expression and the second expression character matching character for the corresponding character in the third expressionDIFFERENCE () returns an integer from 0 to 4, indicatingrelative phonetic difference between expressions of two characters(EMPTY) determines whether the expression is null(GErWORDCOUNr) count a few words in(GETWORDNUM) returns a specified word from a string(INLIST) to determine whether an expression and a set of expressions in a match. '(ISALPHA) to determine the leftmost character expression whether a character is a letter(ISBLANK) to determine whether the expression of null values(ISDIGIT) determine the character expression to the left of a character is digital (0 to 9)(ISLEADBYTE) if the first byte character expression of the first character is a byte, returns true (.T.)(ISLOWER) determine the character expression the leftmost character is lowercase letters(ISMOUSE) to determine whether the computer with mouse(ISNULL) to determine whether the NULL value calculation results(ISUPPER) to determine the first character character expression is uppercase (A ~ z)(LEFT), a character from the leftmost character expression returns a specified number of characters(LEPTC) from the beginning of a character expression of a character on the left returns a specified number of charactersLEN () returns the number of characters in a character expressionLENC () returns the number of characters in the expression to the word(LIKE) to determine whether a character expression is matched with another character expression(LIKEC) to determine whether a character expression is matched with another character expression(LOWER) returns a character expression specified in lowercase letters(LTRIM) a leading space delete character specified, and then return the resulting expression(OCCURS) the number of returns in another character in the expression of a character expression(OEMTOANSI) for a character in the string expression isconverted into the corresponding ANSI character set(PADL), PADR (), PADC () by an expression that returns a character, and from the left, right or from both sides with spaces or characters to fill to the specified length of the string(PROPER) returns a string from a character expression, each string in uppercase first letterRAT (return) first appeared in another character expression or memo field within a character expression or memo field position, from the rightmost character.(RATC) returns a character expression in another character expression or memo field last appeared in the line, from the last line.(RATLINE) line number back to a character expression or memo field in another character expression or memo field appears at the end of the last line, from the start counting.(REPUCATE) returns a string, the string is the specified character expression after repeated a specified number of times(RIGHT) from the beginning of the right string returns a specified number of charactersRIGHTC () returns the right from a specified number of characters in a string(RTRIM) delete a character expression following space after return result stringSOUNDEX (voice) returns a character expression specified representation(SPACE) returns a string consisting of the specified number of spacesSTR () returns the specified numeric expression corresponding to the character(STRCONV) the character expression into another formSTREXTRACT (two) returns a string delimiter between(STRTRAN) in the first character expression or memo field search, second character expressions or memo field, and third character expression - type or memo field replace each occurrence of the second character expressions or memo field(STUFF) returns a string,This string is obtained by the number specified by another character expression to replace the existing character expression of the characters(STUFFC) returns a string, the string is the number specified by another character expression to replace the existing character expression in character, the(SUBSTR) returns a string from a given character expression or memo field(SUBSTRC) returns a string from a given character expression or memo fieldSYS (15) to replace the characters in a stringSYS (20) German text conversion(TEXTMERGE) provide an evaluation on the expression.TRIM () returns the specified character expression after delete all suffix spaces(TXTWIDTH) according to the average width of the character font return character expression length(TYPE) calculation of character expression and returns its contents, data typeUPPER () returns uppercase character expression specified----------------------------------------------Visual FoxPro numerical functionABS (absolute value) returns the specified numeric expressionACOS () returns the arccosine specified numerical value of the expression(ASIN) anyway returns a numeric expression string value radianATAN () returns the arctangent numerical value curve(ATN2) the value of the specified value returned anyway, no limit quadrant return value(BINTOC) the integer represented by binary character.BITAND (two) returns the numeric values in the AND operation by the results(BITCLEAR) refers to a clear positioning numerical numeric (this bit set to 0), and returns the result value(BITLSHIFr) returns a numeric numerical result after moving to the left to the positionBrrNOT () returns a value of type NOT according to the numerical calculation resultsBITOR (two) returns the numeric OR operation according to the numerical results(BITRSHIFF) returns a numeric value to move right after positioning results(BITSET) will be a set value of a numeric 1 and returns the result(BITTEST) to determine the value of a numeric finger positioning is 1BITXOR (two) returns the numeric numerical XOR bitwise resultsCEILING () returns the smallest integer greater than or equal to the specified numeric expressionCOS () returns the numeric expression of Yu Xianzhi(CTOmN) will be converted to an integer type representation of binary characters(DTOR) radians(EVALUATE) to calculate the value of the expression character and returns the result(EVL) a non null value from the two expressions to returnEXP () returns the value of eAx, where x is a numeric expression of a given(FLOOR) on the numerical expression of the given value, returns the largest integer less than or equal to it.FV () returns the future value of a financial investment(INT) a numerical calculation of the value of the expression, and returns the integer part(LOG) the natural logarithm returns a numeric expression (base C)(LOGl0) the common logarithm returns a numeric expression (base 10).(MAX) on the expressions, and returns the expression with maximum value(MIN) to calculate a set of expressions, and returns with the minimum value of the expression(MOD) to remove another numeric expression with a numeric expression that returns the remainder(MTON) a numeric value returned by a currency.(NORMALIZE) to provide users with a character expression can be converted to VisualFoxPro and compared the format function return value(NTOM) returned by a numeric expression containing four decimal currency value(NVL) returns a non null value from two.(PAYMENT) the number of each payment return fixed interest loan repayPI (n) returns a numeric constant(PV) the present value of an investment return(RAND) returns a random number between 0 and 1.ROUND (return) rounded to the specified numeric expression of decimal digits(RTOD) the degree of curvature into(SIGN) when the specified numeric expression value is positive, negative or 0, respectively, 1 -1 or 0 returnSIN () returns a value of the sine angle.SQRT () returns the square root of the specified numeric expressionSYS (2007) returns a character expression check sum valueTAN () returns the value of the tangent angle(VAL) a character expression consists of digits return numeric values----------------------------------------------FTP://********************.net find the help9.chm file in the FTPThis is a function of vfp9.0 command manual contains all command function vfp.You can also join the QQ group VFP heaven:Nineteen million thirty-nine thousand one hundred andthirty-nineNineteen million six hundred and forty-four thousand six hundred and ninety-twoTwenty million one hundred and forty-nine thousand eight hundred and ninety-threeTwenty-one million seven hundred and nine thousand six hundred and twentyThe inside of the master can meet all your questions。

vfp常用函数

一.数值函数:1、绝对值函数 ABS(数值表达式)返回数值表达式的绝对值,返回数据类型:数值型;2、取整函数 INT(数值表达式)返回数值表达式的整数部分,返回数据类型:数值型;3、符号函数 SIGN(数值表达式)测试表达式的值,若为正数,返回1,若为负数,返回-1,若为0,返回0,返回数据类型:数值型;4、取最小整数函数CEILING(数值表达式)返回大于或等于表达式的值的最小整数,返回数据类型:数值型;5、取最大整数函数FLOOR(数值表达式)返回小于或等于表达式的值的最小整数,返回数据类型:数值型;6、四舍五入函数 ROUND(数值表达式,有效位数)对数值表达式按照有效位数进行四舍五入,返回数据类型:数值型;7、求余函数 MOD(数值表达式1,数值表达式2)返回表达式1除以表达式2的余数,同号直接求余,若异号,求余后加上表达式2的值,返回数据类型:数值型8、平方根函数 SQRT(数值表达式)返回数值表达式的平方根,返回数据类型:数值型9、自然对数函数LOG(数值表达式)返回数值表达式的自然对数,返回数据类型:数值型10、圆周率函数 PI( )返回圆周率的值,返回数据类型:数值型二、日期和时间函数1、日期函数 DATE()返回当前系统日期,返回默认格式“mm/dd/yy”,返回的数据类型:日期型;2、求年份函数 YEAR(日期表达式|日期时间表达式)返回指定日期的年份,返回的数据类型:数值;3、求月份函数 MONTH(日期表达式|日期时间表达式)返回指定日期的月份,返回的数据类型:数值;4、求日函数 DAY(日期表达式|日期时间表达式)返回指定日期的日的数值,返回的数据类型:数值;5、系统时间函数 TIME()返回当前系统时间,返回的默认格式“hh:mm:ss”,返回数据类型:字符型;6、系统日期时间函数 DATETIME()返回当前系统日期和时间,返回的数据类型日期时间型三、字符函数1、生成空格函数 SPACE(数值表达式)返回一个空格组成的字符串,空格的个数有数值表达式来决定 ,返回数据类型:字符型2、删除前导空格函数LTRIM(字符表达式)返回指定字符串删除前导空格后的字符串,返回数据类型:字符型。

VFP函数大全

VFP函数大全一、数值函数数值函数用于数值运算,其自变量与函数都是数值型数据。

1.取绝对值函数ABS( )【格式】ABS(<nExp>)【功能】计算nExp的值,并返回该值的绝对值。

2.指数函数EXP( )【格式】EXP(<nExp>)【功能】求以e为底、nExp值为指数的幂,即返回ex的值。

3.取整函数INT( )【格式】INT(<nExp>)【功能】计算nExp的值,返回该值的整数部分。

4.上界函数CEILING( )【格式】CEILING(<nExp>)【功能】计算nExp的值,返回一个大于或等于该值的最小整数。

5.下界函数FLOOR( )【格式】FLOOR(<nExp>)【功能】计算nExp的值,返回一个小于或等于该值的最大整数。

6.自然对数函数LOG( )【格式】LOG(<nExp>)【功能】求nExp的自然对数。

nExp的值必须为正数。

7.常用对数函数【格式】LOG10(<nExp>)【功能】求nExp的常用对数。

nExp的值必须为正数。

8.平方根函数SQRT( )【格式】SQRT(<nExp>)【功能】求非负nExp的平方根。

9.最大值函数MAX( )和最小值函数MIN( )【格式】MAX(<nExp1>,< nExp2>[,< nExp3>...])MIN(<nExp1>,< nExp2>[,< nExp3>...])【功能】返回数值表达式中的最大值MAX( )和最小值MIN( )。

10.求余数函数MOD( )【格式】MOD(<nExp1>,<nExp2>)【功能】返回nExp1除以nExp2的余数。

余数的小数位数与nExp1相同,符号与nExp2相同。

11.四舍五入函数ROUND( )【格式】ROUND(<nExp1>,< nExp2>)【功能】返回nExp1四舍五入的值,nExp2表示保留的小数位数。

VFP函数大全

VFP函数大全%运算符用于计算并返回两个数值表达式相除之后的余数$(包含)运算符用于进行字符表达式之间的包含关系运算,如果一个字符表达式包含在另一个字符表达式之中,则函数返回真ABS()计算并返回指定数值表达式的绝对值ACLASS()用于将一个对象的父类名放置于一个内存数组中ACOPY()把一个数组的元素拷贝到另一个数组中ACOS()计算并返回一个指定数值表达式的余弦值ADATABASES()用于将所有打开的数据库名和它的路径存入一个内在变量数组中ADBOBJECTS()用于把当前数据库中的连接、表或SQL视图的名存入内存变量数组中ADEL()用于从一维数据中删除一个元素,或从二维数组中删除一行或者一列元素ADIR()将文件的有关信息存入指定的数组中,然后返回文件数AELEMENT()通过元素的下标,返回元素号AFIELDS将当前的结构信息存入数组中,然后返回表中的字段数AFONT()将可用字体的信息存入数组中AERROR()用于创建包含VFP或ODBC错误信息的内存变量AINS()在一维数组中插入一个元素或在二维数组中插入一行或一列元素AINSTANCE()用于将类的所有实例存入内存变量数组中,然后返回数组中存放的实例数ALEN()返回数组中元素、行或者列数ALIAS()返回当前工作区或指定工作区内表的别名ALLTRIM()从指定字符表达式的首尾两端删除前导和尾随的空格字符,然后返回截去空格后的字符串AMEMBERS()用于将对象的属性、过程和成员对象存入内存变量数组中ANSITOOEM()将指定字符表达式中的每个字符转换为MS-DOS(OEM)字符集中对应字符APRINTERS()将Print Manager中安装的当前打印机名存入内存变量数组中ASC()用于返回指定字符表达式中最左字符的ASCII码值ASCAN()搜索一个指定的数组,寻找一个与表达式中数据和数据类型相同的数组元素ASELOBJ()将活动的Form设计器当前控件的对象引用存储到内存变量数组中ASIN()计算并返回指定数值表达式反正弦值ASORT()按升序或降序排列数组中的元素ASUBSCRIPT()计算并返回指定元素号的行或者列坐标AT()寻找字符串或备注字段在另一字符串或备注字段中的第一次出现,并返回位置ATAN()计算并返回指定数值表达式的反正切值ATC()寻找字符串或备注字段中的第一次出现,并返回位置,将不考虑表达式中字母的大小写ATCLINE()寻找并返回一个字符串表达式或备注字段在另一字符表达式或备注字段中第一次出现的行号。

VFP函数大全

FEOF用于确定低级文件的指针是否位于该文件的末尾
FERROR测试并返回最近的低级文件函数操作的错误号
FFLUSH将一个用低级文件函数打开的文件刷新到磁盘中
FGETS从指定的文件或用低级文件函数打开的通信端口中读取若干字节;直至读到回车字符才停止
FIELD返回表中某个字段的名称
FILE用于在磁盘中寻找指定的文件;如果被测试的文件存在;函数返回真
ISALPHA用于测试字符表达式中的最左字符是否是一个字母字符
ISBLANK用于确定表达式是否是空表达式
ISCOLOR用于测试当前的计算机是否显示彩色
ISDIGIT用于测试字符表达式的最左字符是否是数字字符
ISEXCLUSIVE用于测试表达式是否按独占方式打开
ISLOWER用于确定指定字符表达式的最左字符是否是一个小写字母字符
VFP函数大全
%运算符用于计算并返回两个数值表达式相除之后的余数
$包含运算符用于进行字符表达式之间的包含关系运算;如果一个字符表达式包含在另一个字符表达式之中;则函数返回真
ABS计算并返回指定数值表达式的绝对值
ACLASS用于将一个对象的父类名放置于一个内存数组中
ACOPY把一个数组的元素拷贝到另一个数组中
CDX用于返回打开的、具有指定索引号的复合索引文件名.CDX
CEILING计算并返回大于或等于指定数值表达式的下一个整数
CHR返回指定ASCII码值所对应的字符
CHRSAW用于确定键盘缓冲区中是否有字符存在
CHRTRAN对字符表达式中的指定字符串进行转换
CMONTH从指定的Date或Datetime表达式返回该日期的月名称
AELEMENT通过元素的下标;返回元素号
AFIELDS将当前的结构信息存入数组中;然后返回表中的字段数
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

EVALUATE(<字符表 达式>)
(<字符表达式>)
ALLTRIM(< 字 符 表 达式>) LTRIM(< 字 符 表 达 式>) TRIM(< 字 符 表 达 式 >)/RTRIM(< 字 符 表达式> LEFT(< 字 符 表 达 式>,<数值表达式>)
返回<字符表达 式>的值. <字符表 达式>是要计算的 表达式,可以是一 个字符串,一个合 法的表达式,内存 变量,数组元素或 任何数据类型的 字段 名表达式就是用 一对括号将名称 括起来,以实现替 换功能 取消<字符表达 式>中的前后空格 取消<字符表达 式>中的左边空格 删除字符串尾部 的空格
349
VAL(<字符表达式>)
FCOUNT()
返回打开表的字 段数 返回第<数值表达 式>个字段的名字 测试表文件开始 状态 测试表文件结束 状态
N
FIELD()
C
BOF() EOF()
L L
DELETED()
RECCOUNT()
RECNO() FILE(<字符表达式>) IIF(<逻辑表达式>, < 表达式 1>,<表达式 2>)
Байду номын сангаас
N
N
N N N N N
N N N N N
N
N
MAX/ MIN (<表达式 1>,<表达式 2>[,< 表达式 3>…] ) SIN(<数值表达式>) PI( ) &< 字 符 型 内 存 变 量>[.<字符表达式>])
N
N
?MAX(3.19,0,-3.19),MIN(3.19,0,-3.19) 3 .19 -3 .19 ?SIN(PI()/2)) 1 ? PI( ) 3.14 STORE "GZ.DBF" TO X USE &X &&相当于执行指令 USE GZ.DBF 宏代换的作用范围是从符号"&"起,直到遇到一 个圆点符"."或空白为止.所以,要在宏代换后面 再加入其他字符,可用圆点符"."将它们分开.例 如: H="GZ" USE &H..DBF 相当于执行了:USE GZ.DBF 宏代换函数可以改变数据类型,将某些字符型常量 转变为逻辑型,数值型.例如: X=".T."
N N C
N N
346
附录 1 Visual FoxPro 函数总表
347 Y="123" ?3>2.AND.&X,456+&Y .T. 579 注意,宏代换函数的替换是间接的.例如: A="DATE()" B="A" ?&B,&A DATE() 12/12/98 X="学生.DBF" USE EVALUATE ('X') &&相当于执行了 USE 学生.DBF 命令 A="9*5" ?EVALUATE("A") &&变量为字符型 9*5 ?EVALUATE(A) &相当于执行了 ? EVALUATE("9*5")命令 45 X="学生.DBF" USE(X) &&相当于执行了 USE 学生.DBF 命令
349
附录 1 Visual FoxPro 函数总表 350 或 SEEK 命 令 执 行,函数的返回值 为"真"(.T.) 返回一个编号,该 编号对应于键盘 缓冲区中第一个 鼠标单击或按键 操作 N DO WHILE FOUND( ) ?姓名,出生年月 CONTINUE ENDDO I=INKEY(0) ?I &&如按下回车键,则 I 的值为 13(即回车键 的 ASCII 码值)
C
C
C C C
C C C
? ALLTRIM( " 计算机基础教学 ") 计算机基础教学 ?LTRIM( " 计算机基础教学 ") 计算机基础教学 ?TRIM( " 计算机基础教学 ") 计算机基础教学 ? LEFT ("计算机基础教学",4) 计算
截取<字符表达 C 式>最左边的<数 值表达式>个字符 为一个子字符串 RIGHT(< 字 符 表 达 截 取 < 字 符 表 达 C 式>,<数值表达式>) 式 > 最 右 边 的 < 数 值表达式>个字符 为一个子字符串 SUBSTR(<字符表达 这里<数值表达式 C 式 >,< 数 值 表 达 式 1> 指 定 取 子 字 符 1>[,< 数 值 表 达 式 的起始位置,<数 2>]) 值表达式 2>指定 取字符的个数.若 缺省<数值表达式 2>或其值大于<字 符表达式>长度 时,则将截取<数 值表达式 1>指定 位置起至最后一 个字符为止的子 串.当<数值表达 式 1>的值为 0 时, 输出空串 AT(<字符表达式 1>, 返回<字符表达式
C
C
C D D D D D C N N N N C
?UPPER("Personal Computer") PERSONAL COMPUTER ?LOWER("Personal omputer") personal computer ?CTOD("10/18/98") 10/18/98 ?DTOC(DATE()) 06/09/01 ?DTOC({^2001-06-09},1) 20010609 ?ASC("APPLE"),ASC("apple") 65 97 ?CHR(98) b ?STR(156.73,6,1) 156.7
C N
N C
?LEN("This is a book.") 15 ?"浙江"+SPACE(6)+"杭州" 浙江 杭州 ?"┌"+REPLICATE("—",10)+"┐" ┌——————————┐ ? TIME() ? DATE( ) ?YEAR(DATE()) ?MONTH(DATE()) ?DAY(DATE()) ? DOW(DATE()) 11 28 4 2007
L
N
N C L L
? FILE("学生 DBF") T NUM=10 ?IIF(NUM>9,STR(NUM,2),STR(NUM,1)) 10
=MESSAGEBOX("杭州")
L
L
IF EMPTY(THIS.DISPLAYVALUE) RETURN .T. ENDIF USE 学生 LOCATE FOR YEAR(出生年月)<=1971
C
C
? RIGHT("计算机基础教学",4) 教学
C
X="12/12/98" ?SUBSTR(X,7,2)+" 年 "+SUBSTR(X,1,2)+" 月 "+ SUBSTR(X,4,2)+"日" 98 年 12 月 12 日 ?SUBSTR(X,7) 98 &&输出余下所有的字符 ?SUBSTR(X,0,7) &&输出空串
附录 1 Visual FoxPro 函数总表 346
Visual FoxPro 常用函数
函 数 名 及 格 说明 式
ABS(<数值表达式>) INT(<数值表达式>) 返回指定数值表 达式的绝对值 返回<数值表达 式>的整数部分(舍 尾) 该函数根据要求 保留小数位,四舍 五入 返回余数 返回以 e 为底的指 数值 返回<数值表达 式>的算术平方根 返回一个 0~1.0 之 间的随机数 返回给定数值表 达式的自然对数 (底数为 e) 该函数根据<数值 表达式>的值为 正,零,负数分别 返回 1,0,-1 返回若干个表达 式中的最大或最 小数 返回一个角度的 正弦值 返回数值常数π 用字符型内存变 量的"值"代替内 存变量的"名"
MESSAGEBOX(< 提 示文本>[, <数值表达 式> [, <标题文本>]]) EMPTY( ) FOUND( )
若当前记录已作 删除标记,该函数 返 回 .T. , 否 则 返 回.F 返回表文件记录 总数(包括已作删 除标记的记录) 返回指定表中当 前记录号 测试指定的文件 是否存在 在<逻辑表达式> 的值为.T.时,返回 <表达式 1>的值; 为.F.时返回<表达 式 2>的值 显示一个用户自 定义对话框 确定表达式是否 为空值 如果 CONTINUE, FIND , LOCATE
STUFF(<字符表达式 1>,<数值表达式 1>,< 数值表达式 2>,<字符 表达式 2>) TYPE(< 字 符 表 达 式>)
C
C
?TYPE("10+8") ?TYPE(".F.OR.T.") ?TYPE("DATE()")
相关文档
最新文档