VF常用函数列表
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常用函数

Visual FoxPro常用函数分类表2008-02-16 19:44VisualFoxPro磁盘_目录_文件函数ADIR()将文件信息存放到数组中,然后返回文件个数。
CURDIR()返回当前目录或文件夹。
DEFAULTEXT()如果一个文件没有扩展名,则返回一个带新扩展名的文件名。
DIRECTORY()若在磁盘上存在指定的目录,返回真(.T.)。
DISPLAYPATH()为显示而截去长路径名到指定长度。
DRIVETYPE()返回指定驱动器的类型。
FDATE()返回文件最近一次修改的日期或日期时间。
FILE()如果在磁盘上找到指定的文件,则返回“真”(.T.)。
FILETOSTR()将一个文件的内容返回为一个字符串。
FORCEEXT()返回一个字符串,使用新的扩展名替换旧的扩展名FORCEPATH()返回一个文件名,使用新路径名代替旧文件名FTIME()返回最近一次修改文件的时间。
FULLPATH()返回指定文件的路径或相对于另一文件的路径。
GETDIR()显示“选择目录”对话框,从中可以选择目录或文件夹。
GETFILE()显示“打开”对话框,并返回选定文件的名称。
JUSTDRIVE()从完整路径中返回驱动器的字母。
JUSTEXT()从完整路径中返回三字母的扩展名。
JUSTFNAME()返回完整路径和文件名中的文件名部分。
JUSTPATH()返回完整路径中的路径名。
JUSTTEM()返回完整路径和文件名中的根名(扩展名前的文件名)。
LOCFILE()在磁盘上定位文件并返回带有路径的文件名。
PUTFILE()激活“另存为…”对话框,并返回指定的文件名。
STRTOFILE()将一个字符串的内容写入一个文件。
SYS(3)返回一个合法文件名,可用来创建临时文件。
SYS(5)返回当前VisualFoxPro的默认驱动器。
SYS(7)返回当前格式文件的名称。
SYS(2000)返回一个按字母排序的与文件名和扩展名梗概匹配的第一个文件名。
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<表达式>]功能:用来替换打开的数据库文件中指定字段的数据。
VisualFoxPro常用函数分类表

VisualFoxPro磁盘_目录_文件函数ADIR()将文件信息存放到数组中,然后返回文件个数。
CURDIR()返回当前目录或文件夹。
DEFAULTEXT()如果一个文件没有扩展名,则返回一个带新扩展名的文件名。
DIRECTORY()若在磁盘上存在指定的目录,返回真(.T.)。
DISPLAYPA TH()为显示而截去长路径名到指定长度。
DRIVETYPE()返回指定驱动器的类型。
FDATE()返回文件最近一次修改的日期或日期时间。
FILE()如果在磁盘上找到指定的文件,则返回“真”(.T.)。
FILETOSTR()将一个文件的内容返回为一个字符串。
FORCEEXT()返回一个字符串,使用新的扩展名替换旧的扩展名FORCEPATH()返回一个文件名,使用新路径名代替旧文件名FTIME()返回最近一次修改文件的时间。
FULLPATH()返回指定文件的路径或相对于另一文件的路径。
GETDIR()显示“选择目录”对话框,从中可以选择目录或文件夹。
GETFILE()显示“打开”对话框,并返回选定文件的名称。
JUSTDRIVE()从完整路径中返回驱动器的字母。
JUSTEXT()从完整路径中返回三字母的扩展名。
JUSTFNAME()返回完整路径和文件名中的文件名部分。
JUSTPATH()返回完整路径中的路径名。
JUSTTEM()返回完整路径和文件名中的根名(扩展名前的文件名)。
LOCFILE()在磁盘上定位文件并返回带有路径的文件名。
PUTFILE()激活“另存为…”对话框,并返回指定的文件名。
STRTOFILE()将一个字符串的内容写入一个文件。
SYS(3)返回一个合法文件名,可用来创建临时文件。
SYS(5)返回当前VisualFoxPro的默认驱动器。
SYS(7)返回当前格式文件的名称。
SYS(2000)返回一个按字母排序的与文件名和扩展名梗概匹配的第一个文件名。
SYS(2003)返回默认驱动器或卷上的当前目录或文件夹的名称。
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函数大全(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。
VF常用函数

函数对于函数需要大家了解的有:1、函数名2、除了&宏函数外,所有函数必须加 ()3、函数的作用4、函数的参数5、函数的返回值及其类型数值运算函数: INT()、ABS()、MAX()、MIN()、SQRT()、ROUND()、MOD()字符处理函数: LEN()、AT()、SPACE()、SUBSTR()、LEFT()、RIGHT()TRIM=RTRIM(TRIM\ALLTRIM\LTRIM\RTRIM)、STUFF()、&:宏函数转换函数: LOWER()、UPPER()、CTOD()、DTOC()、STR()、VAL() ASC()、CHR()日期时间函数: DATE()、TIME()、YEAR()、MONTH()、DAY()测试函数: RECNO()、BOF()、EOF()、FOUND()、FILE()、DBF()、RECCOUNT()、SELECT()、TYPE()、IIF()、其它:ROW()、COL()、INKEY()、READKEY()1.数值处理函数(1)求绝对值函数ABS()【格式】 ABS(<数值表达式>)【功能】返回<数值表达式>的绝对值,参数的类型为N型,得到的函数值的类型为N型。
【例如】输入语句:?ABS(-26.2),ABS(26.6),ABS(-50)显示结果: 26.2 26.6 50注意:语句 ? <内存变量>|<常量>|<表达式>是非格式输出语句,具有计算功能。
语句在命令窗口输入。
(2)求指数函数EXP()【格式】EXP(<数值表达式>)【功能】返回以e为底,<数值表达式>为幂次的指数值。
【例如】输入语句:?EXP(5.5),EXP(1),EXP(-5),EXP(-6)显示结果: 244.69 2.72 0.01 0.00(3)取整函数INT()【格式】 INT(<数值表达式>)【功能】返回<数值表达式>的整数部分。
VF常用函数列表

数值函数:1.绝对值和符号函数格式:ABS(<数值表达式>)SIGN(<数值表达式>)例如:ABS(-5)=5,ABS(4)=4,SIGN(8)=1,SIGN(-3)=-1,SIGN(0)=02.求平方根表达式格式:SQRT(<数值表达式>)例如:SQRT(16)=4,它与开二分之一次方等同。
3.圆周率函数格式:PI()4.求整数函数格式:INT(<数值表达式>)返回数值表达式的整数部分CEILING(<数值表达式>)返回大于或等于表达式的最小整数FLOOR(<数值表达式>)返回小于或等于表达式的最大整数例如:INT(5.8)=5.8,INT(-7.8)=-7,CEILING(6.4)=7,CEILING(-5.9)=-5FLOOR(9.9)=95.四舍五入函数格式:ROUND(<数值表达式1>,<数值表达式2>)功能:返回制定表达式在制定位置四舍五入的结果例如:ROUND(345.345,2)=345.35,ROUND(345.345,1)=345.3,ROUND(345.345,0)=345,ROUND(345.345,-1)=3506.求余函数格式:MOD(<数值表达式1>,<数值表达式2>)例如:MOD(10,3)=1 MOD(10,-3)=-2 MOD(-10,3)=2 MOD(-10,-3)=-1求余数的规律:1.首先按照两数的绝对值求余2.表达式1的绝对值大于表达式2的绝对值,则余数为表达式1的值3.余数取表达式1的正负号4.若两数异好号,余数在加上表达式2的值为最终的结果7. 求最大值和最小值函数MAX(数值表达式列表)MIN (数值表达式列表)例如:MAX(2,3,5)=5 MAX(…2‟,‟12‟,‟05‟)=2MAX(…汽车‟,‟飞机‟,‟轮船‟)字符串比较的规律:字符串比较首先比较第一个字母,如果有结果那就不用在进行比较了。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
数值函数:1.绝对值和符号函数格式:ABS(<数值表达式>)SIGN(<数值表达式>)例如:ABS(-5)=5,ABS(4)=4,SIGN(8)=1,SIGN(-3)=-1,SIGN(0)=02.求平方根表达式格式:SQRT(<数值表达式>)例如:SQRT(16)=4,它与开二分之一次方等同。
3.圆周率函数格式:PI()4.求整数函数格式:INT(<数值表达式>)返回数值表达式的整数部分CEILING(<数值表达式>)返回大于或等于表达式的最小整数FLOOR(<数值表达式>)返回小于或等于表达式的最大整数例如:INT(5.8)=5,INT(-7.8)=-7,CEILING(6.4)=7,CEILING(-5.9)=-5FLOOR(9.9)=95.四舍五入函数格式:ROUND(<数值表达式1>,<数值表达式2>)功能:返回制定表达式在制定位置四舍五入的结果例如:ROUND(345.345,2)=345.35,ROUND(345.345,1)=345.3,ROUND(345.345,0)=345,ROUND(345.345,-1)=3506.求余函数格式:MOD(<数值表达式1>,<数值表达式2>)例如:MOD(10,3)=1 MOD(10,-3)=-2 MOD(-10,3)=2 MOD(-10,-3)=-1求余数的规律:1.首先按照两数的绝对值求余2.表达式1的绝对值大于表达式2的绝对值,则余数为表达式1的值3.余数取表达式1的正负号4.若两数异号,余数在加上表达式2的值为最终的结果7. 求最大值和最小值函数MAX(数值表达式列表)MIN (数值表达式列表)例如:MAX(2,3,5)=5 MAX(…2‟,‟12‟,‟05‟)=2MAX(…汽车‟,‟飞机‟,‟轮船‟)字符串比较的规律:字符串比较首先比较第一个字母,如果有结果那就不用在进行比较了。
如果相等在进行第二个字母的比较,以次类推。
字符函数1.求字符串长度函数格式:LEN(<字符表达式>)功能:返回制定字符表达式的长度,即所包含的字符个数。
函数值为数值型例如:X=“中文Visual FoxPro6.0” 则LEN(X)=202.大小写转换函数格式:LOWER(<字符表达式>)UPPER(<字符表达式>)功能:LOWER将制定表达式值中的大写字母转换成小写字母,其他字符不变UPPER将指定表达式值中的小写字母转换成大写字母,其他字符不变。
例如:LOWER(…X1y2A‟)=x1y2a UPPER(…n=1‟)=N=13.空格字符串生成函数格式:SPACE(<字符表达式>)功能:返回指定数目的空格组成的字符串。
4.删除前后空格函数格式:TRIM(<字符表达式>)LTRIM(<字符表达式>)ALLTRIM(<字符表达式>)功能:TRIM():返回指定字符表达式值去掉尾部空格后形成的字符串LTRIM():返回指定字符表达式值去掉前导空格后形成的字符串ALLTRIM():返回指定字符表达式值去掉前导空格和尾部空格后形成的字符串。
例如:STORE SPACE(1)+”TEST”+SPACE(3) TO SS?TRIM(SS)+LTRIM(SS)+ALLTRIM(SS)LEN(SS)=8,LEN(TRIM(SS))=5,LEN(LTRIM(SS))=7,LEN(ALLTRIM(SS))=45.取子串函数格式:LEFT(<字符表达式>,<长度>)RIGHT(<字符表达式>,<长度>)SUBSTR(<字符表达式>,<起始位置>,<长度>)功能:LEFT(): 从指定表达式值的左端取一个指定长度的子串作为函数值。
RIGHT():从指定表达式值的右端取一个指定长度的子串作为函数值。
SUBSTR():从指定表达式值的起始位置取指定长度的子串作为函数值。
例如:STORE “GOOD BYE!” TO XLEFT(X,2)=GO,SUBSTR(X,6,2)+SUBSTR(X,6)=BYBYE!,RIGHT(X,3)=YE!6.计算子串出现次数函数格式:OCCURS(<字符表达式1>,<字符表达式2>)功能:返回第一个字符串在第二个字符串中出现的次数。
若不存在,则返回0例如:STORE …abracadabra‟ TO SOCCURS(…a‟,S)=5, OCCURS(…b‟,S)=2, OCCURS(…c‟,S)=1, OCCURS(…e‟,S)=07.求子串位置函数格式:AT(<字符表达式1>,<字符表达式2>,<数值表达式>)ATC(<字符表达式1>,<字符表达式2>,<数值表达式>)功能:验证表达式1是否是表达式2的子串,如果是,返回表达式1的首字符在表达式2中的位置,若不是,则为0ATC()与AT()的功能类似,但比较时不区分大小写例如: STORE”This is Visual FoxPro” TO XA T(“fox”,X)=0,ATC(“fox”,X)=16,AT(“is”,X,3)=10,AT(“xo”,X)8.子串替换函数格式:STUFF( <字符表达式1>,<起始位置>,<长度>,<字符表达式2>)功能:用<字符表达式2>的值替换<字符表达式1>中由<起始位置>和<长度>指明的一个子串。
例如:STORE …GOOD BYE!‟ TO S1STORE …MORNING‟ TO S2?STUFF(S1,6,3,S2)=GOOD MORNING!?STUFF(S1,1,4,S2)=MORNING BYE!9.字符替换函数格式:CHRTRAN(<字符表达式1>,<字符表达式2>,<字符表达式3>)功能:当第一个字符中的一个或多个字符与第二个字符串中的某个字符相匹配时,就用第三个字符中的对应字符(相同位置)替换这些字符。
如果第三个字符串包含的字符个数少于第二个字符串包含的字符个数,因而没有对应字符,那么第一个字符串中相匹配的各字符将会被铲除。
如果第三个字符串包含的字符个数多于第二个字符串包含的字符个数,多于字符被删掉。
例如:CHRTRAN(“ABACAD”,”ACD”,”X12”)=XBX1X2CHRTRAN(“计算机ABC”,”计算机”,”电脑”)=电脑ABCCHRTRAN(“大家好!”,”大家”,”您”)=您好!总结:第二个表达式没有的照写,第三个表达式没有的去掉。
10.字符串匹配函数格式:LIKE(<字符表达式1>,<字符表达式2>)功能:比较两个字符串对应位置上的字符,若所有对应字符相匹配,函数返回逻辑真(.T.)否则返回逻辑假(.F.)<字符表达式1>中可以包含通配符*和?。
*可与任何数目的字符相匹配,?可以与任何单个字符相匹配。
例如:STORE “abc” to xSTORE “abcd” to yLIKE(“ab*”,x)=.T.LIKE(“ab*”,y)=.T.LIKE (x,y)=.F.LIKE(“?b?”,x)=.T.LIKE(“ABc”,x)=.F.日期和时间函数1.系统日期和时间函数:格式:DATE():返回当前系统日期,函数值为日期型TIME():以24小时制、HH:MM:SS格式返回当前系统时间(字符型)DATETIME():返回当前系统日期时间,函数值为日期时间型2.求年份、月份、天数函数格式:YEAR(<日期表达式>|<日期时间表达式>)MONTH(<日期表达式>|<日期时间表达式>)DAY(<日期表达式>|<日期时间表达式>)3.时、分和秒函数格式:HOUR(<日期时间表达式>)MINUTE(<日期时间表达式>)SEC(<日期时间表达式>)数据类型转换函数1.数值转换成字符串格式:STR(<数值表达式>,<长度>,<小数位数>)例如:STORE –123.456 TO NSTR(N,9,2)=-123.46,STR(N,6,2)=-123.5STR(N,3)=***,STR(N,6)=-123,STR(N)=-1232.字符串转换成字符格式:VAL(<字符表达式>)例如:STORE …-123.‟ TO X,STORT …45‟ TO YSTORE ‟A45‟ TO ZVAL(X+Y)=123.45,VAL(X+Z)=123.00,VAL(Z+Y)=0.003.字符串转换成日期或日期时间格式:CTOD(<字符表达式>)转化成日期型数据CTOT(<字符表达式>)转化成日期时间型数据4.日期或日期时间转化成字符串格式:DTOC(<日期表达式>|<日期时间表达式>[,1])TTOC(<日期时间表达式> [,1])功能TOC()将日期型数据或日期时间数据的日期部分转化成字符串TTOC()将日期时间数据转化成字符串声明:对DTOC()来说,如果选项是1,则字符串的格式总是YYYYMMDD,8个字符。
对TTOC()来说,如果使用选项1,则字符串格式总是YYYYMMDDHHMMSS,14个字符例如:STORE DATETIME() TO TDTOC(T)=11/11/2005, DTOC(T,1)=20051111,TTOC(T)=11/11/2005 18:54:34 PM TTOC (T,1)=200511111854345宏替换函数格式:&<字符变量>[.]功能:替换出字符变量的内容,即去掉定界符。
例如:kk=“456”, ?&kk*100=45600测试函数1.值域测试函数格式:BETWEEN(<表达式T>,<表达式L>,<表达式H>)例如:STORE NULL TO X;STORE 100 TO YBETWEEN(150,Y,Y+100)=.T.BETWEEN(90,X,Y)=NULL2.空值(NULL值)测试函数格式:ISNULL(<表达式>)例如:STORE .NULL. TO XISNULL(X)=.T.3“空”值测试函数格式:EMPTY(<表达式>)P76详细讲解4.数据类型测试函数格式:VARTYPE (<表达式>[,<逻辑表达式>])功能:测试表达式的类型,返回一个大写字母,函数值为字符型2.空值(NULL值)测试函数格式:ISNULL(<表达式>)3.表文件尾测试函数格式:EOF([<工作区号>|<表别名>])4.表文件头测试函数格式:BOF([<工作区号>|<表别名>])5.记录号测试函数格式:RECNO([<工作区号>|<表别名>])6记录个数测试函数RECCOUNT ([<工作区号>6.条件测试函数格式:IIF(<逻辑表达式>,<表达式1>,<表达式2>)功能:测试<逻辑表达式>的值,表达式逻辑若为真,函数返回<表达式1>的值,若为逻辑假,函数返回<表达式2>的值,<表达式1>和<表达式2>表达式类型不要求相同。