StringTools - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Names and Strings : StringTools Package : Combinatorics on Words : StringTools/IsPalindrome

StringTools

 IsPalindrome
 test whether a string is a palindrome

 Calling Sequence IsPalindrome( s )

Parameters

 s - string

Description

 • The IsPalindrome(s) command returns the value true if s is a palindrome, and the value false otherwise. A palindrome is a string s that is equal to its reverse: $s=\mathrm{Reverse}\left(s\right)$.
 • If s is the empty string, the command returns true.

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $\mathrm{IsPalindrome}\left(""\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{IsPalindrome}\left("aaa"\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{IsPalindrome}\left("abc"\right)$
 ${\mathrm{false}}$ (3)
 > $\mathrm{IsPalindrome}\left("abcba"\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{IsPalindrome}\left("tenet"\right)$
 ${\mathrm{true}}$ (5)
 > $\mathrm{IsPalindrome}\left("tenets"\right)$
 ${\mathrm{false}}$ (6)
 > $\mathrm{IsPalindrome}\left("ROTOR"\right)$
 ${\mathrm{true}}$ (7)
 > $\mathrm{IsPalindrome}\left("civic"\right)$
 ${\mathrm{true}}$ (8)
 > $\mathrm{IsPalindrome}\left("semitimes"\right)$
 ${\mathrm{true}}$ (9)
 > $\mathrm{IsPalindrome}\left("kinnikinnik"\right)$
 ${\mathrm{true}}$ (10)
 > $\mathrm{IsPalindrome}\left("reliefpfeiler"\right)$
 ${\mathrm{true}}$ (11)
 > $\mathrm{IsPalindrome}\left("attordidrotta"\right)$
 ${\mathrm{true}}$ (12)
 > $\mathrm{IsPalindrome}\left("saippuakauppias"\right)$
 ${\mathrm{true}}$ (13)

 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam