SUB( ) |
Substitute Text |
SUB(string$,search$,replace$[,instance])[,ERR=stmtref])
Where:
instance |
Optional. Integer. Which occurrence to find:
|
| ||||||
search$ |
Value for which to search. String expression. Cannot be null. |
| ||||||
replace$ |
Text to replace the original search text, if found. String expression. You must include a replace value; however, the value can be null; e.g. sub(A$,B$,"",0,err=100). |
| ||||||
stmtref |
Program line number or statement label to which to transfer control. |
| ||||||
string$ |
String expression containing the string in which to search-and-replace and perform the substitution. |
|
Converted string.
The SUB( ) function performs a substitution within a string. The search value cannot be null. (That generates an Error #46: Length of string invalid.) If no substitutions occur, no error is generated.
print 'CS';
list
A$="Hello there",B$="e",Z$=sub(A$,B$,"",0)
print Z$+" "+A$
end
->run
Hllo thr Hello there