Anonymous user
Strip a set of characters from a string: Difference between revisions
Strip a set of characters from a string (view source)
Revision as of 02:53, 6 June 2011
, 13 years ago→{{header|PureBasic}}: improved speed
(→{{header|OCaml}}: Added PureBasic) |
(→{{header|PureBasic}}: improved speed) |
||
Line 30:
PureBasic uses a single (for ASCII) or a two-byte (for Unicode) null to signal the end of a string. Nulls are thus excluded from the allowable characters to strip as they can't be included in a PureBasic string.
<lang PureBasic>Procedure.s stripChars(source.s, charsToStrip.s)
Protected i, *ptrChar.Character, length = Len(source), result.s
*ptrChar = @source
For i = 1 To
If Not FindString(charsToStrip, Chr(*ptrChar\c))
result + Chr(*ptrChar\c)
|