isalnum
isalnum(c::Union{Char,AbstractString}) -> Bool
Tests whether a character is alphanumeric, or whether this is true for all elements of a string. A character is classified as alphabetic if it belongs to the Unicode general category Letter or Number, i.e. a character whose category code begins with 'L' or 'N'.
Examples
julia> isalnum('A')
true
julia> isalnum('4')
true
julia> isalnum('#')
false
julia> isalnum("Hello123")
true
julia> isalnum("Hello!")
false
In the above examples:
- The character 'A' is alphanumeric, so
isalnum('A')
returnstrue
. - The character '4' is also alphanumeric, so
isalnum('4')
returnstrue
. - The character '#' is not alphanumeric, so
isalnum('#')
returnsfalse
. - The string "Hello123" contains only alphanumeric characters, so
isalnum("Hello123")
returnstrue
. - The string "Hello!" contains a non-alphanumeric character ('!'), so
isalnum("Hello!")
returnsfalse
.
This function can be used to check if a character or all characters in a string are alphanumeric. It returns true
if all characters satisfy the condition, and false
otherwise.
See Also
BigFloat, BigInt, Dict, eltype, fieldtype, Float32, Float64, IntSet, isa, isalnum, isalpha, isascii, iseltype, isequal, isgraph, isimmutable, isinteractive, isleaftype, isnull, ispunct, isspace, issubtype, keytype, Nullable, NullException, promote_type, typeintersect, typejoin, typemax, typemin, typeof, Val, valtype,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.