StringTools - Maple Programming Help

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

StringTools

 IsLower
 determine if a character is lowercase
 IsUpper
 determine if a character is uppercase
 IsAlpha
 determine if a character is alphabetic

 Calling Sequence IsLower(char) IsUpper(char) IsAlpha(char)

Parameters

 char - string; character to test

Description

 • The IsLower(char) command determines whether char is 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 char is a lowercase letter, then IsLower returns true. Otherwise, false is returned.
 • The IsUpper(char) command determines whether char is 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 char is an uppercase letter, then IsUpper returns true. Otherwise, false is returned.
 • The IsAlpha(char) command determines whether char is an alphabetic character. A character is alphabetic if it is either upper or lowercase.
 If char is an alphabetic character, IsAlpha returns true. Otherwise, false is returned.
 • For these procedures, if char is a string that contains more than one character, then all the characters in the string are tested. The procedures returns true if the condition is true of all characters in the input string. For the empty string, the tested condition is vacuously true.
 • 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[IsLower], StringTools[IsUpper] and StringTools[IsAlpha] 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)
 > $\mathrm{Select}\left(\mathrm{IsUpper},s\right)$
 ${"ABCDEFGHIJKLMNOPQRSTUVWXYZ"}$ (2)
 > $\mathrm{Select}\left(\mathrm{IsLower},s\right)$
 ${"abcdefghijklmnopqrstuvwxyz"}$ (3)
 > $\mathrm{Select}\left(\mathrm{IsAlpha},s\right)$
 ${"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"}$ (4)