Main > Software Forum

Simple Basic (VB) question...

(1/2) > >>

Minwah:
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:

ChicagoDave:

--- Quote from: 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:

--- End quote ---

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 "?????"

Minwah:
That's exactly it, thanks very much...was driving me mad!  :applaud:

Howard_Casto:
I've gotta ask... what in the world are you going to use it for?

Minwah:

--- Quote from: 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?

--- End quote ---

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! :)

Navigation

[0] Message Index

[#] Next page

Go to full version