StringTools - Maple Programming Help

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

StringTools

 IsVowel
 determine if a string consists entirely of vowels

 Calling Sequence IsVowel(s)

Parameters

 s - string; any Maple string

Description

 • The IsVowel(s) command tests whether every character in its argument s is an English language vowel.
 The vowels are, by definition, the ten characters $"a"$, $"e"$, $"i"$, $"o"$, $"u"$, $"A"$, $"E"$, $"I"$, $"O"$ and $"U"$. No other character is a vowel. In particular, the characters $"y"$ and $"Y"$ are not considered to be vowels for this test.
 • If every character of the string s is a vowel character, then the value true is returned. Otherwise, the value false is returned. For the empty string, the tested condition is vacuously true.

 • The StringTools[IsVowel] command is thread-safe as of Maple 15.

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $\mathrm{IsVowel}\left("E"\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{IsVowel}\left("T"\right)$
 ${\mathrm{false}}$ (2)
 > $\mathrm{seq}\left(\mathrm{IsVowel}\left(\mathrm{ch}\right),\mathrm{ch}="aeiouAEIOU"\right)$
 ${\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{true}}$ (3)
 > $\mathrm{IsVowel}\left("eye"\right)$
 ${\mathrm{false}}$ (4)
 > $s≔\mathrm{Ι}\left(1..255\right):$
 > $\mathrm{length}\left(s\right)$
 ${255}$ (5)
 > $\mathrm{Select}\left(\mathrm{IsVowel},s\right)$
 ${"AEIOUaeiou"}$ (6)
 > $\mathrm{IsConsonant}≔s→\mathrm{IsAlpha}\left(s\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{and}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{not}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathrm{IsVowel}\left(s\right)$
 ${\mathrm{IsConsonant}}{≔}{s}{→}{\mathrm{StringTools}}{:-}{\mathrm{IsAlpha}}{}\left({s}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{not}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{StringTools}}{:-}{\mathrm{IsVowel}}{}\left({s}\right)$ (7)
 > $\mathrm{Remove}\left(\mathrm{IsConsonant},\mathrm{Ι}\left("a".."z"\right)\right)$
 ${"aeiou"}$ (8)