Results 1 to 2 of 2

Thread: Generate words from a list of letters

  1. #1

    Thread Starter
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Generate words from a list of letters

    I am attempting to write a program that will take a list of letters (i.e., asdfjkleirugh) and create words (i.e. sad, self, dark, dad, fail, etc.). I want it to be able to create words from 2 to whatever number of letters the user specified. This is what I came up with:

    VB Code:
    1. Dim a1 As Long
    2. Dim a2 As Long
    3. Dim a3 As Long
    4. Dim a4 As Long
    5. Dim ConstCombo1 As String
    6. Dim ConstCombo2 As String
    7. Dim ConstCombo3 As String
    8. Dim VolCombo1 As String
    9. Dim WordCombo As String
    10.  
    11. For a1 = 1 To 10
    12.     For a2 = 1 To 4
    13.         For a3 = 1 To 10
    14.             For a4 = 1 To 10
    15.                 ConstCombo1 = Choose(a1, "s", "d", "f", "j", "k", "l", "r", "u", "g", "h")
    16.                 VolCombo1 = Choose(a2, "a", "e", "i", "u")
    17.                 ConstCombo2 = Choose(a3, "s", "d", "f", "j", "k", "l", "r", "u", "g", "h")
    18.                 ConstCombo3 = Choose(a4, "s", "d", "f", "j", "k", "l", "r", "u", "g", "h")
    19.                
    20.                 WordCombo = ConstCombo1 & VolCombo1 & ConstCombo2 & ConstCombo3
    21.             Next a4
    22.         Next a3
    23.     Next a2
    24. Next a1

    Any ideas? Thanks
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    I've attached a form that will give you all the combinations of any number of letters. To find real words however you'll need to do something like link up with a Word dictionary.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width