nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
81d447e
)
stdlib: Char, added functions is_alpha and is_alphanumeric (used for several operatio...
author
Lucas BAJOLET
<r4pass@r4pass-ubu-laptophp.(none)>
Tue, 5 Mar 2013 22:35:18 +0000
(17:35 -0500)
committer
Lucas Bajolet
<r4pass@hotmail.com>
Tue, 19 Mar 2013 18:06:49 +0000
(14:06 -0400)
Signed-off-by: Lucas BAJOLET <r4pass@hotmail.com>
lib/standard/string.nit
patch
|
blob
|
history
diff --git
a/lib/standard/string.nit
b/lib/standard/string.nit
index
b80cb04
..
ad0beda
100644
(file)
--- a/
lib/standard/string.nit
+++ b/
lib/standard/string.nit
@@
-543,6
+543,19
@@
redef class Char
return false
end
+ # Returns true if the char is an alpha digit
+ fun is_alpha: Bool
+ do
+ if (self >= 'a' and self <= 'z') or (self >= 'A' and self <= 'Z') then return true
+ return false
+ end
+
+ # Returns true if the char is an alpha or a numeric digit
+ fun is_alphanumeric: Bool
+ do
+ if self.is_numeric or self.is_alpha then return true
+ return false
+ end
end
redef class Collection[E]