Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi extract and verify (https://www.delphipraxis.net/119321-extract-verify.html)

mohfa 24. Aug 2008 19:15


extract and verify
 
Hello :

Const Head:String='BTR';

Var
S:String ;
Begin
S:='myfirstfile.doc';

end;

So what i want is :

to verify that the S always starts with 'BTR' i mean like

if not (S) starts with ('BTR') then exit else Continue .


S:=BTRmyfirstfile.doc =True
S:=myfirstfile.doc =false

and i want to be sure the file name contains only A..Z or 0..9 so only letters and numbers .

How could i do like this verification .


Thank you

toms 24. Aug 2008 19:45

Re: extract and verify
 
Hello

Zitat:

to verify that the S always starts with 'BTR' i mean like

if not (S) starts with ('BTR') then exit else Continue .
The function AnsiStartsStr() indicates whether one string is a (case-sensitive) prefix of another.

AnsiStartsStr returns True if the string specified by ASubText appears as the leading part of the string specified by AText. Comparison is performed case-sensitively.


Zitat:

and i want to be sure the file name contains only A..Z or 0..9 so only letters and numbers .
Go through all characters in the string and check if they are within the desired range (A..Z or 0..9)


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:00 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz