April 29th, 2004, 04:58 PM
Another way is to use Pascal's set operator to see if a character is within a set of characters or not. Incidentally, you can refer to a single character in a string by its index, instead of using Copy.
procedure TForm1.Button1Click(Sender: TObject);
sIn : string;
ch : char;
sIn := Edit1.Text;
ch := upcase(sIn);
if (ch in ['A', 'E', 'I', 'O', 'U']) then
ShowMessage(sIn + ' starts with vowel')
ShowMessage(sIn + ' starts with consonant');
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne