Fortune Telling Collection - Comprehensive fortune-telling - VF common function

VF common function

Numeric function:

1. Absolute value and sign function

Format: ABS ()

Symbol (< numerical expression >)

For example: ABS (-5) = 5, ABS (4) = 4, sign (8) = 1, sign (-3) =- 1, and sign (0) = 0.

2. Find the square root expression

Format: sqrt ()

For example, SQRT( 16)=4, which is equal to an open half power.

3.Pi function

Format: PI ()

4. Find the integer function

Format: int () returns the integer part of a numeric expression.

The ceiling (< numerical expression >) returns the smallest integer greater than or equal to the expression.

Floor (< numeric expression >) returns the largest integer less than or equal to the expression.

For example:

INT(5.8)=5.8,INT(-7.8)=-7,CEILING(6.4)=7,CEILING(-5.9)=-5

Lower limit (9.9)=9

5. Rounding function

Format: circular (; , < numerical expression 2 >; )

Function: Returns the result of rounding the formula expression at the formula position.

For example, Round (345.345,2) = 345.35, Round (345.345, 1) = 345.3, Round (345.345,0) = 345,

ROUND(345.345,- 1)=350

6. Complementary function

Format: mod (; , < numerical expression 2 >; )

For example:

MOD( 10,3)= 1 MOD( 10,-3)=-2 MOD(- 10,3)=2 MOD(- 10,-3)=- 1

The law of remainder: 1. First, the remainder is calculated according to the absolute values of two numbers.

2. If the absolute value of the expression 1 is greater than that of the expression 2, the remainder is the value of the expression 1.

3. The remainder takes the sign of the expression 1.

4. If the two numbers are different, the value of Expression 2 is added with the remainder to get the final result.

7. Find the maximum and minimum functions.

MAX (list of numeric expressions)

MIN (list of numerical expressions)

For example: max (2,3,5) = 5max (? 2? ,? 12? ,? 05? )=2 MAX(? Cars? ,? A plane? ,? A boat? )

String comparison law:

String comparison compares the first letter first, and if there is a result, there is no need to compare. If the second letter is compared, and so on.

character function

1. Find the string length function

Format: len ()

Function: Returns the length of the formula character expression, that is, the number of characters contained. The function value is a number.

For example: X= "Chinese Visual FoxPro6.0" and LEN(X)=20.

2. Case conversion function

Format: Below ()

UPPER(& lt; Character expression >)

Function: LOWER converts uppercase letters in the value of a formula expression into lowercase letters, and other characters remain unchanged.

UPPER converts lowercase letters in the specified expression value into uppercase letters, and other characters remain unchanged.

For example: low (? X 1y2A? ) =x 1y2a (? n= 1? )=N= 1

3. Spatial string generation function

Format: space ()

Function: Returns a string consisting of a specified number of spaces.

4. Delete the function of leading and trailing spaces.

Format: trim ()

LTRIM(& lt; Character expression >)

all trim(& lt; Character expression >)

Function: TRIM (): Returns a string formed by deleting trailing spaces from the specified character expression value.

LTRIM (): Returns a string formed by deleting leading spaces from the specified character expression value.

ALLTRIM (): Returns a string formed by deleting leading spaces and trailing spaces from the specified character expression value.

For example: store space (1)+ "test"+space (3) to ss.

Fine tuning (SS)+LTRIM(SS)+ALLTRIM(SS)

LEN(SS)=8,LEN(TRIM(SS))=5,LEN(LTRIM(SS))=7,LEN(ALLTRIM(SS))=4

5. Take substring function as an example.

Format: left (,< length >)

Right (< character expression >, < length >)

SUBSTR(& lt; Character expression >, < start position >, < length >)

For example: shops? - 123.? Go to x STORT? 45? To y

Shop? A45? To z

0VAL(X+Y)= 123.45,VAL(X+Z)= 123.00,VAL(Z+Y)=0.00

3. The string is converted into a date or date time.

Format: ctod () is converted into date data.

CTOT(& lt; Character expression >) into date and time data.

4. The date or date time is converted into a string.

Format: dtoc (| <; Date time expression > [,1])

TTOC(& lt; Date time expression > [,1])

The TOC () function converts the date part of date data or date-time data into a string.

TTOC () converts date and time data into strings.

Declaration: For DTOC (), if the option is 1, the format of the string is always YYYYMMDD, with 8 characters. For TTOC (), if the option 1 is used, the string format is always YYYYMMDDHHMMSS, 14 characters.

For example:

Store DATETIME () in t

DTOC(T)= 1 1/ 1 1/2005,DTOC(T, 1)= 2005 1 1 1,

TTOC(T) =111/200518: 54: 34 pm ttoc (t,1) = 20051.

5 macro substitution function

Format:&; & lt character variable > [. ]

Function: Replace the contents of character variables, that is, remove the separator.

For example: kk = "456 ",&kk *100 = 45600.

test function

1. Range test function

Format: between (

For example: store NULL to x; ; Store 100 to y

Between (150, y, y+100) = .t.

BETWEEN(90,X,Y)=NULL

2. Null test function

Format: blank ()

For example: STORE .NULL. TO X

ISNULL(X)=.T。

3 "Null" value test function

Format: empty ()

4. Data type test function

Format: vartype ([,< logical expression >])

Function: tests the type of expression and returns a capital letter. The function value is a character type.

2. Null test function

Format: blank ()

3. Table file tail test function

Format: eof ([| <; Table alias >])

4. Table file header test function

Format: BOF ([| <; Table alias >])

5. Record number test function

Format: recno ([| <; Table alias >])

6 Record number test function

RECCOUNT([& lt; Work area code >

6. Conditional test function

Format: IIF (,< expression1>; ,< expression 2>)

Function: Test whether the expression logic is true, and the function returns;

If logically false, the function returns.

For example: x =100; Y=300

IIF(X >; 100,X-50,X+50)= 150; IIF(Y & gt; 100,Y-50,Y+50)=250

7. Record deletion test function

Format: deleted ([| <; Table alias >])

VF command and function command

Store {} | {} | {/} in the database & empty the date store {:} to tblankdate &;; & Empty date and time

Set STRICTDATE to [0 |1]&; & turn off date format check 0 off1on # define <; Emoji > & Assign symbol (compile) constant # undefined & release the defined constant storage to < variable list >; & memory variable allocation

List memory [like <; Wildcard >] [Print | to < file name >]&; & Display memory variable DISPLY is used for split-screen display.

Declare array name 1 (line number [,column number]) [,array name 2 (line number [,column number])] ... & define an array, or you can use DIMENSION to define a function.

Basic data types of VF: C- character type, N- numeric type, I- integer type and F- floating-point type.

B- double precision Y- currency L- logic D- date T- date and time M- remark G- general type

* & ltExpc & gt character expression

ABS & ltExpn & gt& amp& absolute value int < Expn >& amp& unconditional rounding.

Circular (& ltExpn & gt, n)&; & Round off. N & gt=0, n+ 1 after the decimal point, n < 0 before the decimal point, n digits. N is the decimal point, sqrt < expn & gt & square root. Expenditure must be greater than 0.

LOG/LOG 10 & lt; Expn & gt & natural logarithm/logarithmic index & natural index sin

The ceiling & ltExpn & gt& amp& returns the minimum integer lower bound.

Signature & ltExpn & gt& amp& symbolizes function. If Expn & gt0, =0,<0, return 1, 0,-1 rand.

LEN & ltExpc & gt& amp& tests the length of the string and returns an N-type.

SUBSTR(& lt; Expc & gt,& ltexpn 1 & gt; [,& ltExpn2 & gt])& amp; & Intercept Expn2 characters starting from Expn 1 If Expn2 is omitted, it will be intercepted from Expn 1 to the end.

Lslim & ltexpc & gt & delete the space rtrim/trim.

Alltrim & ltex PC> & delete the spaces before and after Expc and return to C & type;; < character storage variable >; [.]& amp; & macro replacement

& ltexpc 1 & gt; $ & ltExpc2 & gt& amp& Test whether 1 contains 2. Return. t。 f.at(

STUFF(& lt; expc 1 & gt; ,& ltexpn 1 & gt; , & ltExpn2 & gt, & ltExpc2 & gt)& amp& replace. Replace n2 c 1 character PADC (

PADL(& lt; Exp & gt,& ltExpn & gt[,& ltExpc & gt])& amp; & left padding padr (

Transform (& ltExp & gt, & ltExpc & gt)& amp& display Exp, for example, according to the requirements of Expc? Transform (131.137, "$ $ $ .999") $131.

Date () & current system date, returns T-shaped time ()&; & Current system time, return type cDatetime ()&; & System date and time, return to T type.

Year (& ltExpd & gt| & ltExp & gt)& amp& year. Returns the year value corresponding to d|t, n-type month (