Results 1 to 7 of 7

Thread: Function for replicating a character

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    88
    Is there a function in the VB that replicates a specific character?
    For example, I need to put 100 of a zero string.

    Note. I need a build-in function or better way which doesn't use a loop.

  2. #2
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    I am pretty sure you are gonna have to use a loop to do this, there is no built in function that I am aware of.
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  3. #3
    Addicted Member
    Join Date
    Mar 2000
    Location
    Gainesville, FL
    Posts
    131
    Yes, you use String.


    To make 100 spaces, you'd do this:

    strString = String(100, " ")

  4. #4
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Will this better?

    Code:
    Dim strString As String
    strString = String(100, chr(0)) 
    or 
    strString = String(100, vbNull)

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Chris, i think you mean vbNullchar. vbNull is used as returnvalues for variants
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Oops...

    Oops... being catch by ked-Guru....

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    88
    Thanks alot. The String function is what I've been looking for..

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