QBasic/Working With Strings

What are strings and what are they used for?

edit

In QBASIC, a string is a contiguous sequence of ASCII encoded characters in memory. The characters are stored in memory as an 8 bit byte. Strings in QBASIC are mutable meaning they can be changed in place without allocating new memory. By now if you have read the prior chapters, you should know that strings are typically used to represent numbers, letters, and other symbols and are used to display information on screen, and getting user input. In the Files chapter you will find that strings can be saved into and read from files as well. If you get creative you can use strings for other purposes. One example is adding large numbers hundreds of digits long. In QBASIC you cannot do that with its built in numeric data types. You could however store the digits in string form and write your own function to add a couple of strings containing digits together thus overcoming some of the initial QBASIC constraints.

Functions

edit

Character Functions

edit

Chr$

edit

String Functions

edit

Conversion

edit
Lcase$
edit
Str$
edit
Ucase$
edit

Generator

edit
Space$
edit
String$
edit
edit
InStr
edit

Size Of

edit

Splice

edit
Left$
edit
Mid$
edit
Right$
edit

Truncate

edit
Ltrim$
edit
Rtrim$
edit

Memory Manipulation Functions

edit

Peek

edit

Poke

edit

SADD

edit

Examples

edit