views:

118

answers:

1

Greetings,

Is there was test or a predicate I can use in prolog to verify that a certain given character is alphabetical? Right now, what I'm doing is:

List of unallawed characters: \n -> 10, space -> 32, !->33, .->46, ,->44, :->58, ;->59% % 63->? , 45 -> -, 34->", 39-> %

\+member(Ch,[10, 32, 33, 34, 39, 44, 45, 46, 58, 59, 63 ]), %Checking for line return           (\n),     space, punctuations

Those are only a few of the characters I need to check for. having a test such as letter(Ch). would save me a great deal of time, and above all be a way more defensive approach.

Thank you

+2  A: 

is_alpha/1

There are also other predicates such as is_lower/1 etc.

starblue
Thank you! This is exactly what I needed!For is_lower: as it happens, I needed to work with all letters of the same capitalisation (I was doing a program that validates palindromes.) But instead, now that I can filter all that is not a letter, I can use downcase_atom on all my letters.Thanks :D It's always great to see some interest in prolog, I like it a lot myself.
ManicMailman