Space(n) doesn't work...This does

Results 1 to 3 of 3

Thread: Space(n) doesn't work...This does

  1. #1
    Rob Guest

    Default Space(n) doesn't work...This does

    I was trying to make multi column listboxes and found that HTML doesn&#039;t support it. It was recommended to me to use "aaa" & Space(3) & "bbb" to get three spaces in between. HTML only uses the first space and forgets the rest. The next suggestion I got was to manually type in "&nbsp;" for all of the spaces that I wanted. That doesn&#039;t make for a very dynamic code. I decided to combine all of these and make my own solution. "Physician, heal thyself."<BR><BR>Function SpaceMaker (ByRef SpaceNum)<BR> <BR> SpaceMaker = ""<BR> For a = 1 to SpaceNum<BR> SpaceMaker = SpaceMaker & "&nbsp;"<BR> Next<BR> <BR>End Function<BR><BR><BR>Simple, yes. But I don&#039;t accept "It can&#039;t be done." very well. Now I enter the string "aaa" & SpaceMaker(6-Len("aaa")) & "bbb" to get three spaces in between. It works only on monofonts.<BR><BR>I hope this helps someone out there.

  2. #2
    Rob Guest

    Default RE: Space(n) doesn't work...This does

    I just looked at my post and realized that "&_n_b_s_p_;" (without the underscores) looks like this: " ".<BR><BR>Sorry for the confusion (if any).

  3. #3
    Join Date
    Dec 1969

    Default A faster way...

    Would be to use Space(n) and then do text=Replace(test," ","&amp;nbsp;")<BR><BR>Using the builtin functions of VBS is almost always *much* faster than writing your own.<BR><BR>

Posting Permissions

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