Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell if a character is an ASCII uppercase letter in Clojure

Tags:

ascii

clojure

I got a seq like this:

(\$ \# \A \( \* \& \9 \8 \7 \Z \f)

I want to filter out uppercase ASCII letters in it like \A and \Z

I tried to look up in the standard library but no luck.

Can anybody help me?

like image 297
yehe Avatar asked Feb 28 '13 11:02

yehe


People also ask

How do you check if a character is an uppercase letter?

isUpperCase(char ch) determines if the specified character is an uppercase character. A character is uppercase if its general category type, provided by Character. getType(ch), is UPPERCASE_LETTER. or it has contributory property Other_Uppercase as defined by the Unicode Standard.

How do you check if a character in a string is uppercase?

To check if a letter in a string is uppercase or lowercase use the toUpperCase() method to convert the letter to uppercase and compare it to itself. If the comparison returns true , then the letter is uppercase, otherwise it's lowercase.

How do you check if the first letter of a string is uppercase C?

The C library function int isupper(int c) checks whether the passed character is uppercase letter.


1 Answers

Use the following

(filter #(Character/isUpperCase %) `(\$ \# \A \( \* \& \9 \8 \7 \Z \f))

Results : (\A \Z)

like image 162
Abimaran Kugathasan Avatar answered Sep 22 '22 05:09

Abimaran Kugathasan