Re: I suppose the idea of classes and inheritance is
- From: Jamie <jamie_ka1lpa_not_valid_after_ka1lpa_@xxxxxxxxxxx>
- Date: Thu, 12 Oct 2006 11:19:47 -0700
J French wrote:
On Wed, 11 Oct 2006 12:08:42 -0700, Jamieprocedure TForm1.Button1Click(Sender: TObject);
<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;
var
S:String;
X:Integer;
C:char;
begin
C:= #$FF;
S := 'Test';
X := 5;
C := S[X];
if C = #0 then Beep;
end;
the above test does not generate a range error.
test your findings first please.
--
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5
.
- Follow-Ups:
- Re: I suppose the idea of classes and inheritance is
- From: J French
- Re: I suppose the idea of classes and inheritance is
- From: Rob Kennedy
- Re: I suppose the idea of classes and inheritance is
- References:
- I suppose the idea of classes and inheritance is
- From: Genome
- Re: I suppose the idea of classes and inheritance is
- From: Maarten Wiltink
- Re: I suppose the idea of classes and inheritance is
- From: Genome
- Re: I suppose the idea of classes and inheritance is
- From: Jamie
- Re: I suppose the idea of classes and inheritance is
- From: Maarten Wiltink
- Re: I suppose the idea of classes and inheritance is
- From: Jamie
- Re: I suppose the idea of classes and inheritance is
- From: J French
- I suppose the idea of classes and inheritance is
- Prev by Date: Re: try - except
- Next by Date: Re: try - except
- Previous by thread: Re: I suppose the idea of classes and inheritance is
- Next by thread: Re: I suppose the idea of classes and inheritance is
- Index(es):