Analysis of common VB functions in national computer grade examination level 2
y=sgn (x): symbolic function
Description: y=1 when x 0; Y=0 when x=0; When x 0, y=-1
example: ite SGN (5)
output: 1
sin (x), cos (x), Tan (x), ATN (x): trigonometric function
ctype (x): type conversion:
convert x to "Boolean" value
p=cbyte (x)
byte
p=ccur (x)
amount
date
p=cintl (x)
double precision
p=cdbl (x)
integer
p=clng (x)
long integer
p=csng (x)
single precision
p=cstr (x)
string
example: ite cdbl (#1/1/1900#)
result: 2
note: true: -1 false: 0
date: #12/30/1899# is 0, and the value is increased by 1 every next day Subtract 1
int (x) from the value of each previous day: take the integer value of =x
fix (x): take the integer part of X and directly remove the decimal part
ite int (-54.6)
the result is: -55 Take the maximum integer of =-54.6
ite int (54.6)
result: 54
ite fix (54.6)
result: 54
ite fix (-54.6)
result: -54
asc (x): returns the character code of the first character of the string
chr (x): returns the character of character code X
p=asc ("a") p=65
p=chr (65) p=a
10.
filter: find a specific string in the string array
p=filter (x, s[, include[, compare]])
parameter x is a string array, and parameter s is the string to be searched. After calling, all x array elements containing string s will be combined to form another string array, and then returned. Filter can also select the array elements without s string after searching. At this time, the parameter three include should be set to false If you search regardless of case, compare is set to vbtextcompare
example:
redimx (2)
x (0) = "kjdfs": X (1) = "wandfkj": X (2) = "fsda"
v=filter (x, "kJ", false)
result: V (0) = "fsda"
11
instr (x, y) find the position of Y from the first character of x
12
instr (n, x, y)find the position where y appears from the nth character of X
if y is found in X, the return value is the position where the first character of Y appears
if n string length, X is an empty string, or y cannot be found in X, 0 is returned
if y is an empty string, return n.
instrrev to look for the string upside down
p=instrrev (C, s[, n[, compare]])
look forward from the back of string x, and if found, return the position of s string in the character
n is to search from the first few characters. Set compare to search regardless of case
13
join (x[, d]) combines the string array into a string They are also very familiar with the security situation of various factories and construction sites
parameter x is a string array. After calling join, all string elements of X will be combined into a string, and then returned
Thed parameter is used to specify the separator character
x=array ("Da", "fdsa", "FDAs")
p= "Da, fdsa, DSAs"
len (x): calculate the length of string X
the length of the empty character is 0, and the space is also a character. Although the Chinese side occupies 2bytes, it is also a character
14, left (x, n): returns n characters to the left of string X
if n=0, an empty string is returned; if n =len (x), the entire string is returned
15, mid (x, n): read all the following characters from the nth character of X
mid (x, N, m): read M characters from the nth character of X
if n len (x), an empty string is returned. If the nth character is less than M characters, all subsequent characters are returned
16.ltrim (x), rtrim (x), trim (x): remove empty characters
ltrim (x) remove all characters to the left of X
trim (x) remove all characters on the left and right sides of X
rtrim (x) remove all characters on the right side of X
spaces between characters will not be removed
x=ltrim ("this is good")
result: x= "this is good"
x=trim ("this si good")
result: x= "this is good"
ght (x, n): returns n characters to the right of string X
p=replace (x, s, R)
replace the string s in the string x with the string r, and then return
x= "ASP is good"
p=replace (x, good, nice)
p= "ASP is nice"
space (n): return the string composed of N spaces,
p=space (n, x): return the string composed of the first character of N X
x can be a string or a character code
18, split: invade a string into a string array
p=split (s[, d])
take the D parameter as the separating character, and then infringe the string s into multiple strings to form a string array. Then return. If the D parameter is omitted, the space character is used as the separator character
p=split ("a, B, C", "P")
p (0) = "a", P (1) = "B", P (2) = "C"
19, strreverse: reverse the string
pstrreverse (x)
returns the string after X parameter inversion
p=streve's energy consumption and greenhouse gas emissions in the use stage RSE ("ABC")
p= "CBA"
20 ucase (x), lcase (x): convert the case of English letters
p=lcase (x) converts the uppercase letter of string x to lowercase
p=ucase (x) converts the lowercase letter of string x to uppercase
only English letters will be affected
var arrarbaiducp but the emergence of new lightweight automotive materials does put forward new requirements for testing and other links roconfig=new array(); arrBaiduCproConfig['uid'] =120380; And because the computer is powerful, arrbaiducproconfig['n'] ='lw365cpr'; arrBaiduCproConfig['tm'] =30; arrBaidu
LINK
Copyright © 2011 JIN SHI