I was working last week and suddenly I came up with this.
It could be very useful ^^,
; #FUNCTION# ;=============================================================================== ; Name ..........: _StringStripChar ; Description ...: Strips the givin characters out of a givin string. ; Syntax ........: _StringStripChar($sString, $sChars) ; Parameters ....: $sString - String to strip out the characters. ; $sChars - Characters to be stripped. ; Return values .: Success - Returns the stripped string. ; Failure - Returns 0 and Sets @Error: ; |0 - No error. ; |1 - No string givin. ; |2 - No characters givin. ; Author ........: Almar Mulder ; Modified ......: - ; Remarks .......: - ; Related .......: StringStripWS, StringStripCR ; Link ..........: - ; Example .......: Yes ; #END# ;==================================================================================== Func _StringStripChar($sString, $sChars) Local $vNothing = "" If $sString == "" Then Return SetError(1, 0, 0) If $sChars == "" Then Return SetError(2, 0, 0) If StringLen($sChars) > 1 Then $sSplit = StringSplit($sChars, "") For $i = 1 To $sSplit[0] $sString = StringReplace($sString, $sSplit[$i], $vNothing) Next Else $sString = StringReplace($sString, $sChars, $vNothing) EndIf Return SetError(0, 0, $sString) EndFunc ;==>_StringStripChar
AlmarM
Edited by AlmarM, 10 June 2009 - 03:36 PM.












