File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
CSharp.lua/CoreSystem.Lua/CoreSystem
test/BridgeNetTests/Batch1/src/SimpleTypes Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,10 @@ local function get(s, index)
73
73
return c
74
74
end
75
75
76
+ local function isAsciiLetter (c )
77
+ return (c >= 65 and c <= 90 ) or (c >= 97 and c <= 122 )
78
+ end
79
+
76
80
local function isDigit (c , index )
77
81
if index then
78
82
c = get (c , index )
@@ -86,7 +90,7 @@ local function isLetter(c, index)
86
90
c = get (c , index )
87
91
end
88
92
if c < 128 then
89
- return ( c >= 65 and c <= 90 ) or ( c >= 97 and c <= 122 )
93
+ return isAsciiLetter ( c )
90
94
else
91
95
return (c >= 0x0400 and c <= 0x042F )
92
96
or (c >= 0x03AC and c <= 0x03CE )
@@ -107,6 +111,7 @@ local Char = System.defStc("System.Char", {
107
111
EqualsObj = Int .EqualsObj ,
108
112
GetHashCode = Int .GetHashCode ,
109
113
default = Int .default ,
114
+ IsAsciiLetter = isAsciiLetter ,
110
115
IsControl = function (c , index )
111
116
if index then
112
117
c = get (c , index )
Original file line number Diff line number Diff line change @@ -329,5 +329,20 @@ public void IsLetterWithStringAndIndexWorks()
329
329
#endif
330
330
Assert . False ( char . IsLetter ( "0" + '\u0100 ' , 0 ) , "#10" ) ;
331
331
}
332
+
333
+ [ Test ]
334
+ public void IsAsciiLetterWorks ( )
335
+ {
336
+ Assert . True ( char . IsAsciiLetter ( 'A' ) , "Should match uppercase letter (first)" ) ;
337
+ Assert . True ( char . IsAsciiLetter ( 'Z' ) , "Should match uppercase letter (last)" ) ;
338
+ Assert . True ( char . IsAsciiLetter ( 'a' ) , "Should match lowercase letter (first)" ) ;
339
+ Assert . True ( char . IsAsciiLetter ( 'z' ) , "Should match lowercase letter (last)" ) ;
340
+
341
+ Assert . False ( char . IsAsciiLetter ( '@' ) , "Should not match character before 'A'" ) ;
342
+ Assert . False ( char . IsAsciiLetter ( '[' ) , "Should not match character after 'Z'" ) ;
343
+ Assert . False ( char . IsAsciiLetter ( '`' ) , "Should not match character before 'a'" ) ;
344
+ Assert . False ( char . IsAsciiLetter ( '{' ) , "Should not match character after 'z'" ) ;
345
+ Assert . False ( char . IsAsciiLetter ( '0' ) , "Should not match digit" ) ;
346
+ }
332
347
}
333
348
}
You can’t perform that action at this time.
0 commit comments