Size of string variables?

Blitz3D Forums/Blitz3D Beginners Area/Size of string variables?

Ross C(Posted 2006) [#1]
How many bytes does a strong variable use? Is it depending on the length of the string? Is there a limit to how many characters can be stored in a string?

Thanks :o)


degac(Posted 2006) [#2]
from the help file:

Each string is stored in the file as a 4 byte (32bit) integer followed by the characters that form the string. The integer contains the number of characters in the string, i.e. its length. Note, that Carriage Return, Line Feed and Null characters are NOT use to indicate the end of the string.
...



summary: 4 bytes+characters, I think therefore the limit is the 'range' or 4 bytes...


jfk EO-11110(Posted 2006) [#3]
The limit is set by the 32bit signed int that is used to store it's length: about 2 billion characters. The string does also contain 4 bytes that are not part of the string but are used to handle it: the lengt of it (the mentioned 32 Bit).As far as I remember a string uses Stringlength plus 4 bytes in memory.
EDIT: degac was faster :.(


Ross C(Posted 2006) [#4]
Sorry for not picking that up guys... Thanks!


Sir Gak(Posted 2006) [#5]
Which means, for all practical purposes, that strings are basically unlimited. Approx. 2 billion characters is a LOT of info. My 300+ page sci-fi/fantasy novel The Hiders In Darkness was only about 1.7 MBs in size, well under 10 million characters, so a Blitz string could hold 20 full length novels, in one string. Need 20 more novels? Well, just create a new string. Repeat as needed.


Ross C(Posted 2006) [#6]
Nah, 10,000 is more than i'll ever need tbh :o)


octothorpe(Posted 2006) [#7]
And He said let there be floppy disks.
And there were floppy disks.
And He looked at the floppy disks and saw that they could hold 10,000 bytes.
Lo, and he said unto the cherubs: count thee to 10,000, and the cherubs grew listless and ambled about.
And He knew that they were good.


Ross C(Posted 2006) [#8]
i see... hehe