Strip a set of characters from a string: Difference between revisions

(→‎{{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 Len(source)length
If Not FindString(charsToStrip, Chr(*ptrChar\c))
result + Chr(*ptrChar\c)
Anonymous user