Friday 15 March 2013

delphi - How to verify if the first character in a string is letter or number? -



delphi - How to verify if the first character in a string is letter or number? -

only business relationship queries, complaints , suggestions valid business relationship numbers processed, write subprogram called validateaccnum receive business relationship number string indicating weather valid or not. valid business relationship number must satisfy next criteria:

the business relationship number must have 7 characters.

the business relationship number must start letter.

the problem having figuring out if first character of business relationship number string or integer. heres code:

procedure tfrmquestion3.validateaccnum(accnum: string); var realaccnum : boolean; accnumlength : integer; startaccnum : string; begin realaccnum := false; accnumlength := length(accnum); startaccnum := accnum[1]; if (accnumlength = 7) , (startaccnum = string) // <--- // problem, know wrong realaccnum = true else exit; end;

so how check weather string character or integer?

if (length(accnum) = 7) , ischaralpha(accnum[1])

you can check ^                                       |

delphi delphi-7

No comments:

Post a Comment