Search the Community
Showing results for tags 'Strip'.
-
I thought this function may be useful to some people. It works in almost the same way as the core AutoIt function StringStripWS. The difference is that you can specify any characters to be stripped. Note: The function is case sensitive ;======================================================================================================== ; ; Function Name: _StringStripChr($sString_In, $sChr, $iFlags = 2, $iCount = 0) ; Description: ; Parameters: ; $sString_In - The string to be stripped ; $sChr - The characters to be stripped (case sensitive) ; $iFlags - Flag to indicate the type of stripping that should be performed (add the flags together for multiple operations): ; 1 = strip leading instances of characters in $sChr ; 2 (Default) = strip trailing instances of characters in $sChr ; 4 = Replace multiple instances of characters in $sChr with a single instance ; 8 = strip all instances of $sChr (over-rides all other flags) ; $iCount - The max number of leading or trailing instances of $sChr to strip ; 0 (Default) = Strip all ; ; Requirement: None. ; Return Value: Stripped string ; Author: Bowmore ; ; Notes: ; ; Examples: ; _StringStripChr("AAAAbdcaefgA", "A", 3, 0) ; would return ; "bdcaefg" ; ; _StringStripChr("AAAAbdcaefgA", "A", 2, 0) ; would return ; "AAbdcaefg" ; ; _StringStripChr("ABCAAbdcaefgA", "AB", 7, 0) ; would return ; "CAbdcaefg" ; ; _StringStripChr("ABCAAbdcaefgA", "ABe", 8, 0) ; would return ; "Cbdcafg" ; ;======================================================================================================== Func _StringStripChr($sString_In, $sChr, $iFlags = 2, $iCount = 0) Local $sNewString = $sString_In Local $sChr1 = "" If (BitAND($iFlags, 8) = 8) Then For $i = 1 To StringLen($sChr) $sChr1 = StringMid($sChr, $i, 1) $sNewString = StringReplace($sNewString, $sChr1, "", 0, 1) Next Else If (BitAND($iFlags, 4) = 4) Then For $i = 1 To StringLen($sChr) $sChr1 = StringMid($sChr, $i, 1) $sNewString = StringRegExpReplace($sNewString, $sChr1 & "{2,}", $sChr1) Next EndIf If (BitAND($iFlags, 2) = 2) Then If $iCount = 0 Then While (StringInStr($sChr, StringRight($sNewString, 1), 1)) $sNewString = StringTrimRight($sNewString, 1) WEnd Else For $i = 1 To $iCount If (StringInStr($sChr, StringRight($sNewString, 1), 1)) Then $sNewString = StringTrimRight($sNewString, 1) Else ExitLoop EndIf Next EndIf EndIf If (BitAND($iFlags, 1) = 1) Then If $iCount = 0 Then While (StringInStr($sChr, StringLeft($sNewString, 1), 1)) $sNewString = StringTrimLeft($sNewString, 1) WEnd Else For $i = 1 To $iCount If (StringInStr($sChr, StringLeft($sNewString, 1), 1)) Then $sNewString = StringTrimLeft($sNewString, 1) Else ExitLoop EndIf Next EndIf EndIf EndIf Return $sNewString EndFunc ;==>_StringStripChr EDIT: Corrected name of function used in examples. Fixed option 4 to work as described. Fixed case sensitivity issue with options 1 and 2
-
Function Reference _GuiImageListEx.au3 Functions that assist with ImageList control management with support a vertical image strip! Sintax: _GUIImageList_AddVerticalStrip( hWnd, hInstance, sImage[, iWidth = 0[, iHeight = 0[, iImgCount = -1 ]]] ) _GUIImageList_DrawVerticalStrip( hWnd, iIndex, hDC, iX, iY[, iStyle = 0 ] ) _GUIImageList_DrawVerticalStripEx( hWnd, iIndex, hDC, iX, iY[, iDX = 0[, iDY = 0[, iStyle = 0 ] ) _GUIImageList_DestroyEx( hWnd ) Supports: ; Bitmaps with vertical image strip! Downloads: Version: 0.12 _GuiImageListEx_(RedirectLink).html Note: Solve this old problem: Need the WinApiEx.au3: Usage example is included! Sample: Fixes: Regards, João Carlos.
- 4 replies
-
- _guiimagelist
- draw
-
(and 5 more)
Tagged with: