148
148
149
149
utf8proc_map (s:: AbstractString , flags:: Integer ) = utf8proc_map (String (s), flags)
150
150
151
- function normalize_string (s:: AbstractString ; stable:: Bool = false , compat:: Bool = false , compose:: Bool = true , decompose:: Bool = false , stripignore:: Bool = false , rejectna:: Bool = false , newline2ls:: Bool = false , newline2ps:: Bool = false , newline2lf:: Bool = false , stripcc:: Bool = false , casefold:: Bool = false , lump:: Bool = false , stripmark:: Bool = false )
151
+ function normalize (s:: AbstractString ; stable:: Bool = false , compat:: Bool = false , compose:: Bool = true , decompose:: Bool = false , stripignore:: Bool = false , rejectna:: Bool = false , newline2ls:: Bool = false , newline2ps:: Bool = false , newline2lf:: Bool = false , stripcc:: Bool = false , casefold:: Bool = false , lump:: Bool = false , stripmark:: Bool = false )
152
152
flags = 0
153
153
stable && (flags = flags | UTF8PROC_STABLE)
154
154
compat && (flags = flags | UTF8PROC_COMPAT)
@@ -173,7 +173,7 @@ function normalize_string(s::AbstractString; stable::Bool=false, compat::Bool=fa
173
173
end
174
174
175
175
"""
176
- normalize_string (s::AbstractString, normalform::Symbol)
176
+ Unicode.normalize (s::AbstractString, normalform::Symbol)
177
177
178
178
Normalize the string `s` according to one of the four "normal forms" of the Unicode
179
179
standard: `normalform` can be `:NFC`, `:NFD`, `:NFKC`, or `:NFKD`. Normal forms C
@@ -185,7 +185,7 @@ canonical choice (e.g. they expand ligatures into the individual characters), wi
185
185
being more compact.
186
186
187
187
Alternatively, finer control and additional transformations may be be obtained by calling
188
- `normalize_string (s; keywords...)`, where any number of the following boolean keywords
188
+ `Unicode.normalize (s; keywords...)`, where any number of the following boolean keywords
189
189
options (which all default to `false` except for `compose`) are specified:
190
190
191
191
* `compose=false`: do not perform canonical composition
@@ -211,17 +211,17 @@ For example, NFKC corresponds to the options `compose=true, compat=true, stable=
211
211
```jldoctest
212
212
julia> using Unicode
213
213
214
- julia> "μ" == normalize_string ("µ", compat=true) #LHS: Unicode U+03bc, RHS: Unicode U+00b5
214
+ julia> "μ" == normalize ("µ", compat=true) #LHS: Unicode U+03bc, RHS: Unicode U+00b5
215
215
true
216
216
217
- julia> normalize_string ("JuLiA", casefold=true)
217
+ julia> normalize ("JuLiA", casefold=true)
218
218
"julia"
219
219
220
- julia> normalize_string ("JúLiA", stripmark=true)
220
+ julia> normalize ("JúLiA", stripmark=true)
221
221
"JuLiA"
222
222
```
223
223
"""
224
- function normalize_string (s:: AbstractString , nf:: Symbol )
224
+ function normalize (s:: AbstractString , nf:: Symbol )
225
225
utf8proc_map (s, nf == :NFC ? (UTF8PROC_STABLE | UTF8PROC_COMPOSE) :
226
226
nf == :NFD ? (UTF8PROC_STABLE | UTF8PROC_DECOMPOSE) :
227
227
nf == :NFKC ? (UTF8PROC_STABLE | UTF8PROC_COMPOSE
@@ -281,22 +281,22 @@ category_abbrev(c) = unsafe_string(ccall(:utf8proc_category_string, Cstring, (UI
281
281
category_string (c) = category_strings[category_code (c)+ 1 ]
282
282
283
283
"""
284
- is_assigned_char (c) -> Bool
284
+ Unicode.isassigned (c) -> Bool
285
285
286
286
Returns `true` if the given char or integer is an assigned Unicode code point.
287
287
288
288
# Examples
289
289
```jldoctest
290
290
julia> using Unicode
291
291
292
- julia> is_assigned_char (101)
292
+ julia> isassigned (101)
293
293
true
294
294
295
- julia> is_assigned_char ('\\ x01')
295
+ julia> isassigned ('\\ x01')
296
296
true
297
297
```
298
298
"""
299
- is_assigned_char (c) = category_code (c) != UTF8PROC_CATEGORY_CN
299
+ isassigned (c) = category_code (c) != UTF8PROC_CATEGORY_CN
300
300
301
301
# # libc character class predicates ##
302
302
354
354
"""
355
355
isdigit(c::Char) -> Bool
356
356
357
- Tests whether a character is a numeric digit (0-9).
357
+ Tests whether a character is a decimal digit (0-9).
358
358
359
359
# Examples
360
360
```jldoctest
@@ -396,27 +396,33 @@ false
396
396
isalpha (c:: Char ) = (UTF8PROC_CATEGORY_LU <= category_code (c) <= UTF8PROC_CATEGORY_LO)
397
397
398
398
"""
399
- isnumber (c::Char) -> Bool
399
+ isnumeric (c::Char) -> Bool
400
400
401
401
Tests whether a character is numeric.
402
402
A character is classified as numeric if it belongs to the Unicode general category Number,
403
403
i.e. a character whose category code begins with 'N'.
404
404
405
+ Note that this broad category includes characters such as ¾ and ௰.
406
+ Use [`isdigit`](@ref) to check whether a character a decimal digit between 0 and 9.
407
+
405
408
# Examples
406
409
```jldoctest
407
410
julia> using Unicode
408
411
409
- julia> isnumber('9')
412
+ julia> isnumeric('௰')
413
+ true
414
+
415
+ julia> isnumeric('9')
410
416
true
411
417
412
- julia> isnumber ('α')
418
+ julia> isnumeric ('α')
413
419
false
414
420
415
- julia> isnumber ('❤')
421
+ julia> isnumeric ('❤')
416
422
false
417
423
```
418
424
"""
419
- isnumber (c:: Char ) = (UTF8PROC_CATEGORY_ND <= category_code (c) <= UTF8PROC_CATEGORY_NO)
425
+ isnumeric (c:: Char ) = (UTF8PROC_CATEGORY_ND <= category_code (c) <= UTF8PROC_CATEGORY_NO)
420
426
421
427
"""
422
428
isalnum(c::Char) -> Bool
0 commit comments