ShortString
Memory requirement: 256 bytes (1 byte for the length specification and 255 bytes for the characters).
Property: The data field of the data type Shortstring is an array, made up of data fields of the data type Char. Its length is defined as: ShortString = String[255];
ShortString has the same properties as the string in Turbo Pascal.
Definition of a data field of the data type ShortString:
var
s : ShortString;Examples for the valid assignment values:
s := '0123ABCabc456';
s := s + '! "§ $% & / () =?';
s := 'c';
s := s + IntToStr (45);Examples of invalid assignment of values:
s := True;
s := 4;Caveats
Warning:
low(myShortString)returns0, i. e. the index of the length Byte, not the first character’s index. Likewise,high(myShortString)always returns255. Uselengthinstead.
Nevertheless, a for … in loop will work as expected.
See also
From the Free Pascal wiki, page "ShortString", as it stood on 2023-12-22 after a change by Alextpp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
