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
+ 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
+ `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
@@ -209,17 +209,17 @@ For example, NFKC corresponds to the options `compose=true, compat=true, stable=
209
209
210
210
# Examples
211
211
```jldoctest
212
- julia> "μ" == normalize_string ("µ", compat=true) #LHS: Unicode U+03bc, RHS: Unicode U+00b5
212
+ julia> "μ" == normalize ("µ", compat=true) #LHS: Unicode U+03bc, RHS: Unicode U+00b5
213
213
true
214
214
215
- julia> normalize_string ("JuLiA", casefold=true)
215
+ julia> normalize ("JuLiA", casefold=true)
216
216
"julia"
217
217
218
- julia> normalize_string ("JúLiA", stripmark=true)
218
+ julia> normalize ("JúLiA", stripmark=true)
219
219
"JuLiA"
220
220
```
221
221
"""
222
- function normalize_string (s:: AbstractString , nf:: Symbol )
222
+ function normalize (s:: AbstractString , nf:: Symbol )
223
223
utf8proc_map (s, nf == :NFC ? (UTF8PROC_STABLE | UTF8PROC_COMPOSE) :
224
224
nf == :NFD ? (UTF8PROC_STABLE | UTF8PROC_DECOMPOSE) :
225
225
nf == :NFKC ? (UTF8PROC_STABLE | UTF8PROC_COMPOSE
@@ -275,20 +275,20 @@ category_abbrev(c) = unsafe_string(ccall(:utf8proc_category_string, Cstring, (UI
275
275
category_string (c) = category_strings[category_code (c)+ 1 ]
276
276
277
277
"""
278
- is_assigned_char (c) -> Bool
278
+ isassigned (c) -> Bool
279
279
280
280
Returns `true` if the given char or integer is an assigned Unicode code point.
281
281
282
282
# Examples
283
283
```jldoctest
284
- julia> is_assigned_char (101)
284
+ julia> isassigned (101)
285
285
true
286
286
287
- julia> is_assigned_char ('\\ x01')
287
+ julia> isassigned ('\\ x01')
288
288
true
289
289
```
290
290
"""
291
- is_assigned_char (c) = category_code (c) != UTF8PROC_CATEGORY_CN
291
+ isassigned (c) = category_code (c) != UTF8PROC_CATEGORY_CN
292
292
293
293
# # libc character class predicates ##
294
294
342
342
"""
343
343
isdigit(c::Char) -> Bool
344
344
345
- Tests whether a character is a numeric digit (0-9).
345
+ Tests whether a character is a decimal digit (0-9).
346
346
347
347
# Examples
348
348
```jldoctest
@@ -380,25 +380,31 @@ false
380
380
isalpha (c:: Char ) = (UTF8PROC_CATEGORY_LU <= category_code (c) <= UTF8PROC_CATEGORY_LO)
381
381
382
382
"""
383
- isnumber (c::Char) -> Bool
383
+ isnumeric (c::Char) -> Bool
384
384
385
385
Tests whether a character is numeric.
386
386
A character is classified as numeric if it belongs to the Unicode general category Number,
387
387
i.e. a character whose category code begins with 'N'.
388
388
389
+ Note that this broad category includes characters such as ¾ and ௰.
390
+ Use [`isdigit`](@ref) to check whether a character a decimal digit between 0 and 9.
391
+
389
392
# Examples
390
393
```jldoctest
391
- julia> isnumber('9')
394
+ julia> isnumeric('௰')
395
+ true
396
+
397
+ julia> isnumeric('9')
392
398
true
393
399
394
- julia> isnumber ('α')
400
+ julia> isnumeric ('α')
395
401
false
396
402
397
- julia> isnumber ('❤')
403
+ julia> isnumeric ('❤')
398
404
false
399
405
```
400
406
"""
401
- isnumber (c:: Char ) = (UTF8PROC_CATEGORY_ND <= category_code (c) <= UTF8PROC_CATEGORY_NO)
407
+ isnumeric (c:: Char ) = (UTF8PROC_CATEGORY_ND <= category_code (c) <= UTF8PROC_CATEGORY_NO)
402
408
403
409
"""
404
410
isalnum(c::Char) -> Bool
0 commit comments