The RIGHT$ function returns the rightmost n characters of string x$.
Syntax
LN RIGHT (x$, n)
Where ,
LN : Line Number
x$ : string from which the n right most characters are to be extracted.
n : number of characters
- The value of n must be within the range of 0 to 255
- if n = 0, the null string (length zero) is returned.
Example
Use of RIGHT$ function in the program.
1.
CS 8.3 Display on the creen for RIGHT$ function
Ok
LIST
10 REM use of RIGHT$ function
20 P$ = "GOLDEN RING"
30 Q$ = "RIGHT$ (P$, 4)
40 PRINT " Original String - "; P$
50 PRINT " Extracted String - "; Q$
60 END
RUN
Original String - GOLDEN RING
Extracted String - RING
Ok
2..
CS 8.4 Display on the screen for RIGHT$ function
Ok
LIST
10 REM Learning use of RIGHT$ function
20 LET A$ = "KATHMANDU"
30 FOR I = 1 TO 9
40 Q$ = RIGHT$(A$, I)
50 PRINT Q$
60 NEXT I
70 END
Ok
RUN
U
DU
NDU
ANDU
MANDU
HMANDU
THMANDU
ATHMANDU
KATHMANDU
Ok
No comments:
Post a Comment