Quote Originally Posted by xGTx
Here's what i have now, can it be done better:
Ah well yes, there's a much faster/easier way.

[pascal]procedure TForm1.Button1Click(Sender: TObject);
var allGoodChars : boolean;
x: byte;
text : string;
begin
//our sample string
text := 'Hello Pascal';
allGoodChars := true;
for x := 1 to length(text) do
//check for a-z, A-Z and a space
if not (text[x] in ['a'..'z', 'A'..'Z', ' ']) then
begin
allGoodChars := false;
exit;
end;
//display result
if allGoodChars then
showmessage('All good')
else
showmessage('Wrong char found')
end;[/pascal]

Hope this helps