The square brackets indicate the position of the character in string we would like to store. We usually use the first character entered to store object properties, variables and functions producing a string to a char data type.
REMEMBER! Always use UPCASE with a char data type if needed and NOT uppercase as it produces a string data type.
Directly from an object:
cChar := edtInput.Text[1];
cChar := InputBox(‘Character’,’Enter a character’,’A’) [1];
cChar := rgpSelect.Items[rgpSelect.ItemIndex] [1];
cChar := cboSelect.Items[cboSelect.ItemIndex] [1];
cChar := lstSelect.Items[lstSelect.ItemIndex] [1];
From a string variable:
cChar := sName[1];
From a function that produces a string:
cChar := copy(sLine,1,1) [1];