The functions which are used to process the numeric data are called mathematical functions. The functions which are used to process the numeric data are called mathematical functions. The functions which are used to process the numeric data are called mathematical functions.
UCASE$
It converts string values to uppercase.
Example:
CLS
x$ = "teach school"
PRINT UCASE$(x$)
END
Output
TEACH SCHOOL
LCASE$
It converts string value to lowercase.
Example:
CLS
x$ = "TEACH SCHOOL"
PRINT LCASE$(x$)
END
Output
teach school
LEFT$
it extract and return the number of characters from the let of a string.
Example:
CLS
x$ = "computer"
PRINT LEFT$(x$, 5)
END
Output
compu
RIGHT$
It extract and return the numbers of characters from the right of a string.
Example:
CLS
x$ = "computer"
PRINT RIGHT$(x$, 4)
END
Output
uter
MID$
It is used to pick up the required strings from the string.
Example:
CLS
a$ = "computer"
PRINT MID$(a$, 3, 5)
END
Output
mpute
LTRIM$
LRTIM$ is used to remove the spaces from the left of the string and RTRIM$ is used to remove the spaces from the right of the string.
Example:
CLS
a$ = "computer "
b$ = " science"
PRINT a$ + b$
PRINT RTRIM$(a$) + LTRIM$(b$)
END
Output
computer science
computerscience
LEN
It returns the length of a give string.
Example:
CLS
b$ = "nepal"
PRINT LEN(b$)
END
Output
5
VAL
If both string are started with number value. This function can perform mathematical calculations among them.
Example:
CLS
a$ = "10 boys"
b$ = "20 girls"
total = VAL(a$) + VAL(b$)
PRINT "Total students = "; total
END
Output
Total students = 30
ASC
It returns ASCII value of a character.
Example:
CLS
x$ = "A"
PRINT ASC(x$)
END
Output
65
Some ASCII value of characters are given below
Characters | ASCII value |
A to Z (Capital letters) | 65 to 90 |
a to z (Small letters) | 97 to 122 |
0 to 9 (Numbers) | 48 to 57 |
CHR$
It returns character value of a give ASCII code.
Example:
CLS
FOR i = 65 TO 90
PRINT i; "="; CHR$(i)
NEXT i
END
Output
65 = A
66 = B
.
.
90 = Z
STR$
It converts numeric value to string value, which cannot be used for mathematical calculations.
Example:
CLS
a = 50
b = 20
PRINT "Before using STR$ : "; a + b
PRINT "After using STR$ : "; STR$(a) + STR$(b)
END
Output
Before using STR$ : 70
After using STR$ : 50 70
STRING$
It returns a string of a specified length made up of a repeating character.
Example:
CLS
PRINT STRING$(5, 97)
END
Output
aaaaa
SPACE$
It is used to put blank spaces.
Example:
CLS
PRINT "Class"; SPACE$(6); "Roll.No"
END
Output
Class Roll.NO
TAB
It is used to put Tab.
Example:
CLS
x$ = "Name"
y$ = "Address"
PRINT TAB(5); x$; TAB(10); y$
END
Output
Name Address
DATE$ and TIME$
DATE$ and TIME$ returns the current date and time respectively.
Example:
CLS
PRINT DATE$
PRINT TIME$
END