Results 1 to 2 of 2

Thread: [Resolved] string with x amount of spaces

  1. #1

    Thread Starter
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828

    [Resolved] string with x amount of spaces

    Hiya is there a function supplied with VB (i cant find one) that will fill a string with x amount of whatever character you specify

    For example

    at the mo i'm doing


    for x = min to max
    str = str & " "
    next x

    which is fine

    but is there a function that allows you to add a string to another string, x amount of times, as i'd rather not do a loop each time

    i.e.

    AddStr(strOriginal,strToBeAdded,23)

    would append strToBeAdded onto strOriginal 23 times
    Last edited by darre1; Jan 31st, 2002 at 04:49 AM.
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  2. #2
    Lively Member Ceri's Avatar
    Join Date
    Sep 2000
    Posts
    72

    From MSDN

    String Function


    Returns a Variant (String) containing a repeating character string of the length specified.

    Syntax

    String(number, character)

    The String function syntax has thesenamed arguments:

    Part Description
    number Required;Long. Length of the returned string. If number containsNull, Null is returned.
    character Required; Variant.Character code specifying the character orstring expression whose first character is used to build the return string. If character contains Null, Null is returned.


    Remarks

    If you specify a number for character greater than 255, String converts the number to a valid character code using the formula:

    character Mod 256

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