Scott Moore wrote:
> TC wrote On 11/17/05 08:24,:
>>
>> there is a function that make lowercase of char or string?
>> And there is a standard function that return true/false if
>> char is a character?
>
> All characters are characters. That's why the're called that.
>
> function isalpha(c: char): boolean;
>
> begin
> isalpha := c in ['A'..'Z', 'a'..'z']
> end;
There is no guarantee in Pascal that alphabetical characters are
continuous. You need to enumerate all the possible chars.
>
> function lcase(c: char): char;
>
> begin
> if c in ['A'..'Z'] then c := chr(ord(c)-ord('A')+ord('a'));
> lcase := c
> end;
Again, the same comment applies. You would be better advised to
create and initialize two sets, one consisting of the enumerated
upper case chars, and another for the lower case ones. Then the
isalpha can refer to the set lowers + uppers.
Also, since there is no guarantee of any numeric relation****p
between the corresponding lower and upper case characters, you
probably need some explicit arrays of char for the conversion.
Your solutions will work only for the limited conditions of Ascii
coding, with no allowance for such things as Swedish, German, etc.
characters.
--
Read about the Sony stealthware that is a security leak, phones
home, and is generally illegal in most parts of the world. Also
the apparent connivance of the various security software firms.
http://www.schneier.com/blog/archives/2005/11/sonys_drm_rootk.html


|