## MegaString

Text strings are limited to 62 characters in iziBasic. But, in some cases, it is needed to access wider chunks of data, especially for database files accesses. For example, you might want to read a complete memo from the memo database, or a DOC record.

It is a common habit to limit records size in databases to 4 Kbytes (4096 bytes). So, iziBasic comes with ONE so called "MegaString", which is 4 Kbytes long and that you can use for these purposes, or also to store any data you wish.

Note: even though you can put some character anywhere in the MegaString (see the PUTCHAR$$ and PUTSTRING$$ statements), the MegaString is considered as a CHR$(0) ended text string (like all other text strings).

Warning: the MegaString is not passed with CHAIN, so, if you need it in the new code segment, you should save its content to a temporary file before chaining and reload it from this file in the new code segment.

CLEAR$$

Clears the MegaString

Notes:

- Fills all characters of the MegaString with CHR$(0) characters

GETFIELD$$ #v|n

Retrieves the value stored in a field (NUMFIELD, TEXTFIELD or TEXTFIELD$$) to the MegaString

Notes:

- see the FIELD$ function

INPUT$$ #v|n1[, v|n2]

Input of one file record into MegaString (refer to Files)

Notes:

- if the optional v|n2 parameter is set in the [1...4096] range, a block of v|n2 characters long record will be read, whatever CHR$(0) ending text string characters might be found within the given range.

$ PRINT$$ #v|n1[, v|n2]

Print the content of MegaString to a file record (refer to Files)

Notes:

- All characters of the MegaString before first occurrence of a CHR$(0) character are written to the file
- if the optional v|n2 parameter is set in the [1...4096] range, a block of v|n2 characters long record will be written, whatever CHR$(0) ending text string characters might be found within the given range.

$ PUTCHAR$$ s|t, v|n

Put one character s|t at index v|n of MegaString, v|n is in the range [1...4096]

$ PUTSTRING$$ s|t, v|n

Put one text string s|t starting at index v|n of MegaString, v|n is in the range [1...4096]

TEXTFIELD$$ #v|n1, v|n2, x, y, w, h

Creates and displays a field to input some text, up to v|n2 characters, with the initial value set to the current content of the MegaString.

Notes:

- valid values for v|n2 are in the [1...4096] range
- see the TEXTFIELD statement

LEN$$

Returns the length of the MegaString, in other words returns position of the first occurrence of CHR$(0) minus 1.

Notes:

- in the case you assigned the v|n2 parameter in the INPUT$$ or PRINT$$ statements, LEN$$ might not return the real length of your MegaString as there might be some CHR$(0) characters within the v|n2 range.

GETCHAR$$(v|n)

Returns the v|n th character of the MegaString

GETSTRING$$(v|n1, v|n2)

Returns a v|n2 long text string from the MegaString, starting at position v|n1

Notes:

- If a CHR$(0) character was found, the returned text string will be less than v|n2 long as it is truncated to all characters found before the CHR$(0) one