Function String Words Class

IsAnagram

Return True of the two phrases are anagrams of each others. Anagrams are words which contain the same characters shuffled into different positions. If the characters in one phrase can be rearranged into different positions to become the second phrase, then the two phrases are anagrams of each other.

Signature (Visual Basic / VBA)

Public Function IsAnagram( _
      ByVal vPhraseOne As Variant _
    , ByVal vPhraseTwo As Variant _
    , Optional ByVal vAlphabet As Variant _
    ) As Variant

Code Example

    IsAnagram("Abba", "Baba") = True
    IsAnagram("Tim Taylor", "Mortality") = True
    IsAnagram("Jill Taylor", "Jolly Trail") = True
    IsAnagram("Hello World", "This is a test.") = False

Parameters

Parameter Description
vPhraseOne First of two phrases which are to be checked to determine if they are anagrams of each other. Function returns Null if vPhraseOne is Null of cannot be fixed up to a String.
vPhraseTwo Second of two phrases which are to be checked to determine if they are anagrams of each other. Function returns Null if vPhraseTwo is Null of cannot be fixed up to a String.
vAlphabet The characters within strings vPhraseOne and vPhraseTwo which are to be checked to see if they represent anagrams. vAlphabet defaults to the alphanumeric characters if it is missing or Null or cannot be fixed up to a String.

Notes & Version History

Note See the Shareware program Namegram if your are interested in generating your own anagrams.