Re: I suppose the idea of classes and inheritance is



On Wed, 11 Oct 2006 12:08:42 -0700, Jamie
<jamie_ka1lpa_not_valid_after_ka1lpa_@xxxxxxxxxxx> wrote:

Maarten Wiltink wrote:

"Jamie" <jamie_ka1lpa_not_valid_after_ka1lpa_@xxxxxxxxxxx> wrote in message
news:oavWg.110$XF2.100@xxxxxxxxxxxxxxx
[...]

X := 0;
Repeat
Inc(x);
DirectorName := UpperCase(Name[x]) in ['A'..'Z','_','0'..'9'];
Until Not DirectorName;


Wouldn't this crash (index past end of string) for names that _are_ valid?

Groetjes,
Maarten Wiltink


all strings except the short types use a Null, the Null would not pass
the test and terminate the loop check, all one would have to do is test
for the X index to determine the length of the valid portion.

While the String is 'terminated' with #0, attempting to get at that
index produces a Range Error if Range Checking is turned on.

procedure TForm1.Button1Click(Sender: TObject);
Var
S :String;
C :Char;
begin
{$R+}
S := StringOfChar('a', 10);
C := S[ Length( S ) + 1 ];
ShowMessage( IntToStr( Ord(C) ) );

end;

.