# VF Common function

### 2 thoughts on “VF Common function”

1. Numerical function:
1. The absolute value and symbol function
format: ABS (u003Cnumerical expression>)
SIGN 5, ABS (4) = 4, sign (8) = 1, sign (-3) = -1, sign (0) = 0
2. Find a square expression
Format: SQRT (u003Cvalue Expression>)
For example: SQRT (16) = 4, it is equivalent to one -half of them.
3. Pay rate function
Format: Pi ()
4. Find an integer function
Format: int (u003CNumeral expression>) Return the integer part of the value expression
CEILING u003CNumeric expression>) Returns the minimum integer larger than or equal to the expression
floor (u003CNumeric expression>) to return to the maximum integer that is 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
floor (9.9) = 9
5. Numerical expression 1>, u003CNumeric expression 2>)
Function: Return to the results of formulating expressions in the formulation of four houses
, 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. Find the remaining function
format Formula 2>)
For example:
mod (10,3) = 1 MOD (10, -3) = -2 mod (-10,3) = 2 MOD (-10, -3) =- 1
The law of the remaining numbers: 1. Find the remaining value according to the absolute value of the two numbers
2. The absolute value of expression 1 is greater than the absolute value of expression 2, the remaining number is the value of expression 1
3. The remaining number of the remaining expression 1
4. If the two counts are good, the remaining number is the final result of the expression 2 Value function
max (numerical expression list)
min (numerical expression list)
for example: max (2,3,5) = 5 max („2‟, ‟12‟, ‟05 X) = 2 Max („„ ‟,‟ airplane ‟,‟ ship ‟)
The rules of comparison of string:
Character string compare the first letter first, if there is a result, then do not need to be performed by the result. Compared. If the comparison of the second letter is equal, the secondary category is pushed.
Character function
1. Find the length function of the string
Format: Len (u003Ccharacter expression>)
function: return to the length of the character expression, that is, the characters contained in number. The function value is numerical type
. For example: x = "Chinese Visual FoxPro6.0", LEN (x) = 20
2.
upper (u003Ccharacter expression>)
function: LOWER converts the capital letters in the expression value into a lowercase letter, other characters remain unchanged
upper Become a capital letter, other characters remain unchanged.
, for example: LOWER („x1y2a‟) = x1y2a upper („n = 1‟) = n = 1
3.
Function: Returns the string composed of spaces with a specified paragraph.
4. Delete the front and rear space function
format: Trim (u003Ccharacter expression>)
Ltrim : Trim (): Returns the string formed by the specified character expression value after removing the tail space
ltrim (): Return the specified character expression value to remove the string formed by the previous guide space
allTrim (): Return to the specified character The expression value removed the string formed after the front -guide space and the tail space.
, for example: 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)) = 4
5. Formula>, u003CLevel>)
Right (u003Ccharacter expression>, u003Cquiferous>)
substr (u003Ccharacter expression>, u003Cstarting position>, u003Clength>)
for example: store ‟-123. To X, Stort„ 45 ‟to y
store‟ A45 ‟to z
0val (x y) = 123.45, value (x z) = 123.00, value (z y) = 0.00
3. The string is converted to date or date
format: CTOD (u003Ccharacter expression>) converted to date data
CTOT (u003Ccharacter expression>) converted to date time type Data
4. Date or date convert into string
Formats: DTOC (u003CDate Expressive> | u003CDate Time Expression> [, 1])
ttoc (u003CDate time expression> [, 1])
The function TOC () The date part of the date data or date time data is partially converted into string
ttoc () to convert the date time data into string
Statement: For DTOC () For example, if the option is 1, the format of the string is always yyyymmdd, 8 characters. For TTOC (), if used option 1, the string format is always, 14 characters
for example:
store datetime () to t
dtoc (t) = 11/11/2005 , DTOC (T, 1) = 20051111,
ttoc (t) = 11/11/2005 18:54:34 pm ttoc (t, 1) =
5 macro replace function
format:

2. The function of the function or type conversion in the program plays a certain role in the program. Let me classify some commonly used functions.
(1) Numerous function: The calculation result is numerical type. Common ones are
abs absolute value function
sqrt square root functions
int to take the entire function, only the combined digit is given to the decimal bit
icing back to the minimum integer greater than or equal to the specified value expression
FLOWER returns the maximum integer that is less than or or equal to specified the specified value expression
round four houses and five in -five functions, and returns the result of the specified value expression at the specified position. The negative sign is consistent with the division
max calculate the value in each expression, and returns the maximum value
min to calculate the value in each expression. Returns the minimum value (2) character function: The operation result is the character type. The common ones are
len return to the length of the specified character expression value. In the bytes, a Western character or space accounts for a
character, a Chinese character accounts for two character functions to numerical type r r
lower, UPPER converts the specified character expression into uppercase and lowercase letters, respectively. Other characters remain unchanged
trim, ltrim, alltrim back to the specified character expression and remove The string formed by the rear, first, first, and tail spaces
left, and right takes a sub -skewers with a specified length from the left end and right end of the specified expression value as the function value
substr from the specified position of the specified expression value to take. Specify the sub -string of length as a function
at, ATC If the front string is the sub -string of the rear string, test the position of the first character in the string in the posterior string, Numerical type, ATC does not distinguish between letters and lowercases in the test
stuff from the specified position of the previous character string to specify the character with the post -string replaced
like comparison The characters are matched, the function
The return value is logical, otherwise it is logical false. The front string can contain the dated (3) date and time function
date Return the current system date, the function value is date type
time returns the current system time in the 24 -hour, HH: MM: SS format, and the function value is character type
dateTime back to the current system date time. The date or date of the date or date of the return year, month, number of days
hour, minute, and SEC returned from the specified date time expression to the hour, minute, second part of the number of types (4) type conversion function
str value Converted into string
Val string convert to value
CTOD character converting to date
DTOC date convert to character

Scroll to Top
Scroll to Top