File tree 2 files changed +39
-1
lines changed
2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,26 @@ import is_alphabetic = unicode::derived_property::Alphabetic;
41
41
import is_XID_start = unicode:: derived_property:: XID_Start ;
42
42
import is_XID_continue = unicode:: derived_property:: XID_Continue ;
43
43
44
+ /*
45
+ Function: is_lowercase
46
+
47
+ Indicates whether a character is in lower case, defined in terms of the
48
+ Unicode General Category 'Ll'.
49
+ */
50
+ pure fn is_lowercase ( c : char ) -> bool {
51
+ ret unicode:: general_category:: Ll ( c) ;
52
+ }
53
+
54
+ /*
55
+ Function: is_uppercase
56
+
57
+ Indicates whether a character is in upper case, defined in terms of the
58
+ Unicode General Category 'Lu'.
59
+ */
60
+ pure fn is_uppercase ( c : char ) -> bool {
61
+ ret unicode:: general_category:: Lu ( c) ;
62
+ }
63
+
44
64
/*
45
65
Function: is_whitespace
46
66
@@ -126,4 +146,4 @@ pure fn cmp(a: char, b: char) -> int {
126
146
ret if b > a { -1 }
127
147
else if b < a { 1 }
128
148
else { 0 }
129
- }
149
+ }
Original file line number Diff line number Diff line change @@ -3,6 +3,24 @@ import core::*;
3
3
use std;
4
4
import char;
5
5
6
+ #[ test]
7
+ fn test_is_lowercase ( ) {
8
+ assert char:: is_lowercase ( 'a' ) ;
9
+ assert char:: is_lowercase ( 'ö' ) ;
10
+ assert char:: is_lowercase ( 'ß' ) ;
11
+ assert !char:: is_lowercase ( 'Ü' ) ;
12
+ assert !char:: is_lowercase ( 'P' ) ;
13
+ }
14
+
15
+ #[ test]
16
+ fn test_is_uppercase ( ) {
17
+ assert !char:: is_uppercase ( 'h' ) ;
18
+ assert !char:: is_uppercase ( 'ä' ) ;
19
+ assert !char:: is_uppercase ( 'ß' ) ;
20
+ assert char:: is_uppercase ( 'Ö' ) ;
21
+ assert char:: is_uppercase ( 'T' ) ;
22
+ }
23
+
6
24
#[ test]
7
25
fn test_is_whitespace ( ) {
8
26
assert char:: is_whitespace ( ' ' ) ;
You can’t perform that action at this time.
0 commit comments