GLBasic forum

Feature request => 2D => Topic started by: MrTAToad on 2010-Nov-26

Title: STRING$
Post by: MrTAToad on 2010-Nov-26
One command that would be nice is to have a command that will duplicate a character (or perhaps the complete contents of a string), a given number of time.
Title: Re: STRING$
Post by: Neurox on 2010-Nov-26
Quote from: MrTAToad on 2010-Nov-26
One command that would be nice is to have a command that will duplicate a character (or perhaps the complete contents of a string), a given number of time.

Code (glbasic) Select

// ------------------------------------------------------------- //
// -=#  F_STRING$  // Replica per nĀ°volte la lettera passata#=-
// ------------------------------------------------------------- //
FUNCTION F_string$: wnvolte,wcar$
LOCAL writ$,wl
writ$ = ""
FOR wl = 1 TO wnvolte
   writ$ = writ$ + wcar$
NEXT
RETURN writ$
ENDFUNCTION // F_string$


Bye bye,
Neurox/Paolo
Title: Re: STRING$
Post by: MrTAToad on 2010-Nov-26
I actually use :

Code (glbasic) Select
FUNCTION space$:amount%
LOCAL temp$

temp$=""
WHILE amount%>0
temp$=temp$+" "
DEC amount%
WEND

RETURN temp$
ENDFUNCTION