Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: Minwah on August 29, 2006, 08:06:48 am

Title: Simple Basic (VB) question...
Post by: Minwah on August 29, 2006, 08:06:48 am
Just a quicky....for some reason I can't for the life of me remember the string function to display x amount of a certain character...it works like this, this would return 'c' 10 times:

Keyword("c", 10)

Someone please put me out of my misery, I know it is simple  :banghead:
Title: Re: Simple Basic (VB) question...
Post by: ChicagoDave on August 29, 2006, 08:28:01 am
Just a quicky....for some reason I can't for the life of me remember the string function to display x amount of a certain character...it works like this, this would return 'c' 10 times:

Keyword("c", 10)

Someone please put me out of my misery, I know it is simple  :banghead:

I think you want:

String() - Creates a repeated character string
Language: VBScript

Description
The String() function creates a string of optional length filled with the specified character.

String(length, character)

Example
MyString = String(3, "T") 'returns "TTT"
MyString = String(5, "?") 'returns "?????"

Title: Re: Simple Basic (VB) question...
Post by: Minwah on August 29, 2006, 09:06:49 am
That's exactly it, thanks very much...was driving me mad!  :applaud:
Title: Re: Simple Basic (VB) question...
Post by: Howard_Casto on August 30, 2006, 02:32:57 am
I've gotta ask... what in the world are you going to use it for?
Title: Re: Simple Basic (VB) question...
Post by: Minwah on August 30, 2006, 04:36:07 am
I've gotta ask... what in the world are you going to use it for?

Well as it happens I am not now...but I was going to use it in this context:

.TextWidth(String(x, "W")

...just to return the max width of a bunch of characters (guessing W is one of the widest).

But since all characters are a different width (depending on font), I decided it would be better to use a proper string.  But still, it was just bugging me what the darn keyword was! :)
Title: Re: Simple Basic (VB) question...
Post by: Howard_Casto on August 30, 2006, 10:04:34 pm
Well that's what I was wondering.  it isn't particularly useful unless you are wanting to make a dividing line or something. Thought you might be doing something cool.  ;)