FORWARD PROC Main()
FORWARD STRING PROC FNStringGetInStringS( INTEGER i1, STRING s1 )
// --- MAIN --- //
PROC Main()
STRING s1[255] = "3" // change this
STRING s2[255] = "a" // change this
IF ( NOT ( Ask( "string: get: copy: create concatenated duplicates of a certain string: totalT = ", s1, _EDIT_HISTORY_ ) ) AND ( Length( s1 ) > 0 ) ) RETURN() ENDIF
IF ( NOT ( Ask( "string: get: copy: create concatenated duplicates of a certain string: string = ", s2, _EDIT_HISTORY_ ) ) AND ( Length( s2 ) > 0 ) ) RETURN() ENDIF
Warn( FNStringGetInStringS( Val( s1 ), s2 ) ) // gives "aaa"
Warn( FNStringGetInStringS( 15, "0" ) ) // gives "000000000000000"
Warn( FNStringGetInStringS( 3, " " ) ) // gives " "
Warn( FNStringGetInStringS( 8, "hello" ) ) // gives "hellohellohellohellohellohellohellohello"
END
<F12> Main()
// --- LIBRARY --- //
// library: string: get: in: string <description>create concatenated duplicates of a certain string (STRING$ in BBCBASIC)</description> <version>1.0.0.0.7</version> <version control></version control> (filenamemacro=getstist.s) [<Program>] [<Research>] [kn, zoe, th, 20-05-1999 11:25:55]
STRING PROC FNStringGetInStringS( INTEGER maxI, STRING inS )
// e.g. PROC Main()
// e.g. STRING s1[255] = "3" // change this
// e.g. STRING s2[255] = "a" // change this
// e.g. IF ( NOT ( Ask( "string: get: copy: create concatenated duplicates of a certain string: totalT = ", s1, _EDIT_HISTORY_ ) ) AND ( Length( s1 ) > 0 ) ) RETURN() ENDIF
// e.g. IF ( NOT ( Ask( "string: get: copy: create concatenated duplicates of a certain string: string = ", s2, _EDIT_HISTORY_ ) ) AND ( Length( s2 ) > 0 ) ) RETURN() ENDIF
// e.g. Warn( FNStringGetInStringS( Val( s1 ), s2 ) ) // gives "aaa"
// e.g. Warn( FNStringGetInStringS( 15, "0" ) ) // gives "000000000000000"
// e.g. Warn( FNStringGetInStringS( 3, " " ) ) // gives " "
// e.g. END
// e.g.
// e.g. <F12> Main()
//
INTEGER minI = 1
//
INTEGER I = 0
//
STRING s[255] = ""
//
IF ( maxI <= 0 )
//
RETURN( "" )
//
ENDIF // minimum 1 character width block or more to insert
//
FOR I = minI TO maxI
//
s = Format( s, inS )
//
ENDFOR
//
RETURN( s )
//
END