StringTools - Maple Programming Help

Home : Support : Online Help : Programming : Names and Strings : StringTools Package : Character Class Tests : StringTools/HasASCII

StringTools

 HasASCII
 determine if a string contains ASCII characters

 Calling Sequence HasASCII(s)

Parameters

 s - string; string to test

Description

 • 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](..).

 • The StringTools[HasASCII] command is thread-safe as of Maple 15.
 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $s≔\mathrm{convert}\left(\left[\mathrm{}\left(1..255\right)\right],'\mathrm{bytes}'\right):$
 > $\mathrm{HasASCII}\left(s\right)$
 ${\mathrm{true}}$ (1)
 > $s≔\mathrm{convert}\left(\left[\mathrm{}\left(129..255\right)\right],'\mathrm{bytes}'\right):$
 > $\mathrm{HasASCII}\left(s\right)$
 ${\mathrm{false}}$ (2)