|
STR.Replace |
|
|
string = STR.Replace( InString AS STRING, OldString AS STRING, NewString AS STRING ) AS STRING
Replace one substring with another and returns the new altered string. If it can't find the OldString, the string returned is the same as InString.
Example:
PRINT str.ExtractSubstring( "Kalle,Anka,Nils,Hult", 0, "," ), PRINT str.ExtractSubstring( "Kalle,Anka,Nils,Hult", 1, "," ), PRINT str.ExtractSubstring( "Kalle,Anka,Nils,Hult", 2, "," ), PRINT str.ExtractSubstring( "Kalle,Anka,Nils,Hult", 3, "," ),
PRINT "Found at = ";str.Find( "Kalle Anka", "Anka", 3 ), PRINT str.Replace( "Kalle Anka and Nisse Hult", " ", "_|_" ),
PRINT "'";str.Delete( "Kalle Anka and Nisse Hult wants Fun",_ str.Find( "Kalle Anka and Nisse Hult wants Fun", " wants Fun" ),_ LEN( " wants Fun" ) );"'",
' This will Replace "\" with "\\" so that a full path will print ' correctly with string formatting turned on
OPTION FORMAT ON PRINT "File Name: "; STR.Replace( FILENAME, "\", "\\" ),
END |