How to check if a string contains accented characters (Views: 30)
Problem/Question/Abstract: Our compiler does not support characters with accents. What is the best way to check if the strings we pass to the compiler have accents or not? Answer: If you check to see that every character in the string falls in the range of #$00 to #$7F, you can be sure that it contains no accented letters. Something like this will do: function ContainsAccents(const S: string): Boolean; var I: Integer; begin for I := 1 to Length(S) do if S[I] > #$7F then begin Result := True; Exit; end; Result := False; end; |