Possibilizing.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • samthemist
    New Member
    • Jul 2007
    • 34

    #1

    Possibilizing.

    If i had:
    strName = "Sam"

    Is there a function where it would separate strName into all possibilities using periods, for example:

    Sam
    S.am
    Sa.m
    S.a.m

    Thanks in advance
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    sure, you can always create it as a

    public function periods(str1 as string) as string
    dim array() as string
    (...)
    periods = array
    end function

    Use Mid$ to cut the string, and think how would you do it. Notice that you'll have 2^(n-1) posibilities, where n is the number of letters in your word, so

    redim array (1 to 2^(len(str1)-1))

    woudl be useful.

    HTH

    Comment

    • samthemist
      New Member
      • Jul 2007
      • 34

      #3
      Originally posted by kadghar
      sure, you can always create it as a

      public function periods(str1 as string) as string
      dim array() as string
      (...)
      periods = array
      end function

      Use Mid$ to cut the string, and think how would you do it. Notice that you'll have 2^(n-1) posibilities, where n is the number of letters in your word, so

      redim array (1 to 2^(len(str1)-1))

      woudl be useful.

      HTH
      I know what to do, just not how to do it. Could you make a function for me?

      Comment

      Working...