Chr$(40,5) = "(((((" possible? [Solved]
Posted
#1
(In Topic #607)
Regular

We have a command in Gambas "Space" that will produce X number of repetitions of a space.
The result is
Code (gambas)
- < >
In certain circumstances, this ability is very helpful.
Is there a command in Gambas which would work similarly for any ASCII character, repeating it X number of times?? Or perhaps in a future release, the Chr$() command can be modified to have an optional second argument for number of repetitions? There's certain circumstances where this ability would save a lot of typing.
For example:
Code (gambas)
- (((((((((((Hello!)))))
Code (gambas)
- (Hello!)
Thank you.
Posted
Guru

/comp/gb.util/string/padleft - Gambas Documentation
BruceSwiki" said
Static Function PadLeft ( String As String, Length As Integer [ , Pad As String ] ) As String
SINCE 3.15
Returns a new string that right-aligns the characters in the original string by padding them on the left with a specified string pattern, for a specified total length.
String is the string to pad.
Length is the final length in UTF-8 characters.
Pad is the string pattern used for padding. By default, a space is used.
Examples
Print String.PadLeft("Gambas", 10, ".")
….Gambas
Print String.PadLeft("Gambas", 16, "×->")
×->×->×->×Gambas
Posted
Posted
Regular

Posted
Guru

My answer i thought was just how I'd do it with my knowledge.
Cogier seemed to hit the nail right on the head with the exact solution though
(i didn't know you could even do that with String()
PadLeft PadRight have other uses though and are also good commands to know of
knowledge is power
1 guest and 0 members have just viewed this.


