Michael Clease
29-05-2007, 00:16
' Usage of the STRING$ Keyword example
'
' Written by Abraxas
DIM sMainString as string value "HELLO WORLD"
DIM sStringExpression as string value "THINBASIC"
DIM sSTR AS STRING
DIM Count as DWORD Value 10
DIM n AS BYTE
DIM sMsg as string
sMsg += "sMainString = " & sMainString & $CRLF
sMsg += "sStringExpression = " & sStringExpression & $CRLF
sMsg += "Count = " & Count & $CRLF & $CRLF
' Take a letter from sStringExpression for the string fill character
FOR n = 1 to Len(sStringExpression)
sSTR = STRING$(Count, MID$(sStringExpression, n, 1)) ' Fill sSTR with 10 "T"'s
sMsg += "STRING$(Count, StringExpression) = " & sSTR & $CRLF
next
MsgBox 0, sMsg
'
' Written by Abraxas
DIM sMainString as string value "HELLO WORLD"
DIM sStringExpression as string value "THINBASIC"
DIM sSTR AS STRING
DIM Count as DWORD Value 10
DIM n AS BYTE
DIM sMsg as string
sMsg += "sMainString = " & sMainString & $CRLF
sMsg += "sStringExpression = " & sStringExpression & $CRLF
sMsg += "Count = " & Count & $CRLF & $CRLF
' Take a letter from sStringExpression for the string fill character
FOR n = 1 to Len(sStringExpression)
sSTR = STRING$(Count, MID$(sStringExpression, n, 1)) ' Fill sSTR with 10 "T"'s
sMsg += "STRING$(Count, StringExpression) = " & sSTR & $CRLF
next
MsgBox 0, sMsg