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') returns true.
  • The character '4' is also alphanumeric, so isalnum('4') returns true.
  • The character '#' is not alphanumeric, so isalnum('#') returns false.
  • The string "Hello123" contains only alphanumeric characters, so isalnum("Hello123") returns true.
  • The string "Hello!" contains a non-alphanumeric character ('!'), so isalnum("Hello!") returns false.

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.

*Required Field
Details

Checking you are not a robot: