StringTools
HasASCII
determine if a string contains ASCII characters
Calling Sequence
Parameters
Description
Thread Safety
Examples
HasASCII(s)
s
-
string; string to test
The HasASCII(char) function determines whether s contains any characters in the ASCII character set (ASCII code 1 through 127).
If the string s has at least one character in the ASCII character set, then HasASCII returns true. Otherwise, false is returned.
This function is part of the StringTools package, and so it can be used in the form HasASCII(..) only after executing the command with(StringTools). However, it can always be accessed through the long form of the command by using the form StringTools[HasASCII](..).
All of the StringTools package commands treat strings as (null-terminated) sequences of 8-bit (ASCII) characters. Thus, there is no support for multibyte character encodings, such as unicode encodings.
The StringTools[HasASCII] command is thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
with⁡StringTools:
s≔convert⁡`$`⁡1..255,bytes:
HasASCII⁡s
true
s≔convert⁡`$`⁡129..255,bytes:
false
See Also
convert
length
string
StringTools[IsASCII]
Download Help Document