Programs for strings in QBASIC
* U CASE $ expression
- It converts all letters to capital letter which is given in the expression.
CLS
INPUT "Enter an String"; a$
PRINT UCASE$(a$)
END
* L CASE $ expression
- It converts all letters to small letter which is given in the expression.
CLS
INPUT "Enter an String"; a$
PRINT LCASE$(a$)
END
* LEFT $ expression
- It returns n characters from the left side of the given expression.
CLS
INPUT "Enter an string"; l$
INPUT "Enter how many characters wants to print"; n
PRINT LEFT$(l$, n)
END
* RIGHT $ expression
- It returns n characters from the right side of the given expression.
CLS
INPUT "Enter an string"; r$
INPUT "Enter how many characters wants to print"; n
PRINT RIGHT$(r$, n)
END
* MID $ expression
- It returns n characters from the expression to start position and up to the given length
CLS
INPUT "Enter an string"; r$
INPUT "Enter from which position want to print characters"; n
INPUT "Enter length up to which you want to print”; x
PRINT MID$(r$, n, x)
END
0 Comments
Thank You ! For your love