HasAlpha - Maple Help

StringTools

 HasLower
 determine if a string has any lowercase characters
 HasUpper
 determine if a string has any uppercase characters
 HasAlpha
 determine if a string has any alphabetic characters

 Calling Sequence HasLower(s) HasUpper(s) HasAlpha(s)

Parameters

 s - string; string to test

Description

 • The HasLower(s) command determines whether s has a lowercase letter. A character is lowercase if it is one of the following:

 a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z.

 If s has at least one lowercase letter, then HasLower returns true. Otherwise, false is returned.
 • The HasUpper(s) command determines whether s has an uppercase letter. A character is uppercase if it is one of the following:

 A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z.

 If s has at least one uppercase letter, then HasUpper returns true. Otherwise, false is returned.
 • The HasAlpha(s) command determines whether s has an alphabetic character. A character is alphabetic if it is either upper or lowercase.
 If s has at least one alphabetic character, HasAlpha returns true. Otherwise, false is returned.
 • 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[HasLower], StringTools[HasUpper] and StringTools[HasAlpha] commands are thread-safe as of Maple 15.

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $s≔\mathrm{convert}\left(\left[\mathrm{}\left(1..255\right)\right],'\mathrm{bytes}'\right):$
 > $\mathrm{length}\left(s\right)$
 ${255}$ (1)
 > $s≔\mathrm{Random}\left(30,'\mathrm{lower}'\right)$
 ${s}{≔}{"yhcmxxkyzmifmmfydhnlfmoslddhns"}$ (2)
 > $\mathrm{HasUpper}\left(s\right)$
 ${\mathrm{false}}$ (3)
 > $\mathrm{HasLower}\left(s\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{HasAlpha}\left(s\right)$
 ${\mathrm{true}}$ (5)
 > $t≔\mathrm{Random}\left(30,'\mathrm{alnum}'\right)$
 ${t}{≔}{"AHuTpQa5C8T6ha3urQ3tAsG3hZpFYs"}$ (6)
 > $\mathrm{HasUpper}\left(t\right)$
 ${\mathrm{true}}$ (7)
 > $\mathrm{HasLower}\left(t\right)$
 ${\mathrm{true}}$ (8)
 > $\mathrm{HasAlpha}\left(t\right)$
 ${\mathrm{true}}$ (9)
 > $u≔\mathrm{Random}\left(30,'\mathrm{digit}'\right)$
 ${u}{≔}{"394898792561495559420320378405"}$ (10)
 > $\mathrm{HasUpper}\left(u\right)$
 ${\mathrm{false}}$ (11)
 > $\mathrm{HasLower}\left(u\right)$
 ${\mathrm{false}}$ (12)
 > $\mathrm{HasAlpha}\left(u\right)$
 ${\mathrm{false}}$ (13)