PDA

View Full Version : Usage of the REMOVE$ REPLACE$ REPEAT$ Keywords



Michael Clease
28-05-2007, 13:20
' Usage of the REMOVE$ Keyword example
' Usage of the REPLACE$ Keyword example
' Usage of the REPEAT$ Keyword example
'
' Written by Abraxas


DIM sMainString as string value "HELLO WORLD"
DIM sMatchString as string value "LO"
DIM sStringExpression as string value "ThinBasic "
DIM sNewString as string Value "R"
DIM sREP as STRING
DIM sREM AS STRING
DIM sRPL as STRING
DIM Count as DWORD Value 10
DIM sMsg as string

sREP = REPEAT$(Count, sStringExpression)
sREM = REMOVE$(sMainString,sMatchString)
sRPL = REPLACE$(sMainString, ANY sMatchString, WITH sNewString)

sMsg += "sMainString = " & sMainString & $CRLF
sMsg += "sMatchString = " & sMatchString & $CRLF
sMsg += "sStringExpression = " & sStringExpression & $CRLF
sMSG += "Count = " & Count & $CRLF & $CRLF
sMsg += "REPEAT$(Count, StringExpression) = " & sREP & $CRLF & $CRLF
sMsg += "REMOVE$(sMainString,sMatchString) = " & sREM & $CRLF & $CRLF
sMsg += "REPLACE$(sMainString, [ANY] sMatchString, [WITH] sNewString) = " & sRPL & $CRLF & $CRLF

MsgBox 0, sMsg

ErosOlmi
28-05-2007, 14:29
Done.