BASIC

Author Topic: STRING$  (Read 2703 times)

MrTAToad

  • Guest
STRING$
« 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.

Offline Neurox

  • Mr. Polyvector
  • ***
  • Posts: 184
    • View Profile
    • http://www.borzini.it
Re: STRING$
« Reply #1 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
Paolo Borzini | paolo@borzini.it
The WhiteFly Software | www.thewhitefly.it
Service on line for screen printers | www.4pellicole.it

MrTAToad

  • Guest
Re: STRING$
« Reply #2 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