litlmike Posted April 21, 2008 Share Posted April 21, 2008 I am utterly confused on this. I am attempting to eliminate any @CRLF (Chr(13)) from a string, but after stripping it away using StringStripWS(), the @CRLF is still there. Can someone shed some light on this? Thanks expandcollapse popup#Include <Array.au3> #Include <File.au3> #include <IE.au3> #include <ExcelCOM_UDF.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $avDestination[1]=[""] Global $avCategory[1]=[""] ;Make .ini file Global $iniPath = @ScriptDir & "\SaveData.ini" If NOT FileExists($iniPath) Then _FileCreate ( $iniPath ) IniWriteSection ($iniPath, "Destinations", "") IniWrite ( $iniPath, "Destinations", "1", "Africa" ) IniWriteSection ($iniPath, "Categories", "") IniWrite ( $iniPath, "Categories", "1", "Safaris" ) IniWrite ( $iniPath, "Categories", "2", "Cultural Tours" ) EndIf $Edit1_Text_Array = IniReadSection ( $iniPath, "Categories") $Edit2_Text_Array = IniReadSection ( $iniPath, "Destinations") ;Loop to get just the Destinations For $iCC = 1 To (UBound ($Edit1_Text_Array)-1) If $iCC=1 Then _ArrayPush($avDestination, $Edit1_Text_Array[$iCC][1]) Else _ArrayAdd ($avDestination , $Edit1_Text_Array[$iCC][1]) EndIf Next ;Loop to get just the Categories For $iCC = 1 To (UBound ($Edit2_Text_Array)-1) If $iCC=1 Then _ArrayPush($avCategory, $Edit2_Text_Array[$iCC][1]) Else _ArrayAdd ($avCategory, $Edit2_Text_Array[$iCC][1]) EndIf Next $Edit1_Text =_ArrayToString($avCategory, @CRLF) $Edit2_Text =_ArrayToString($avDestination, @CRLF) ;Make GUI #Region ### START Koda GUI section ### Form=... $Form1 = GUICreate("", 600, 550, 0, 0) $Edit2 = GUICtrlCreateEdit("", 31, 60, 500, 100) GUICtrlSetData (-1, $Edit2_Text) $Edit1 = GUICtrlCreateEdit($Edit1_Text, 31, 180, 500, 100) GUICtrlSetData (-1, $Edit1_Text) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("OK", 256, 315, 75, 25, 0) $CheckboxSaveIni = GUICtrlCreateCheckbox("Save Search", 25, 425, 97, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 SaveSearch2ini () EndSwitch WEnd Func SaveSearch2ini () $CurrentSearchCategories = GUICtrlRead ($Edit2) $CurrentSearchCategories = StringStripWS ( $CurrentSearchCategories,3) ConsoleWrite (StringInStr ($CurrentSearchCategories, Chr(13)) & @CRLF) EndFunc _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Malkey Posted April 21, 2008 Share Posted April 21, 2008 Try StringStripWS ( $CurrentSearchCategories, 8) Link to comment Share on other sites More sharing options...
litlmike Posted April 21, 2008 Author Share Posted April 21, 2008 Try StringStripWS ( $CurrentSearchCategories, 8)Your suggestion does work, but it works to well. It even removes the WS between words, which is not desirable. For example, the words "Cultural Tours" should not appear as "CulturalTours". Any suggestions? _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
weaponx Posted April 21, 2008 Share Posted April 21, 2008 Change 8 to 4.... Link to comment Share on other sites More sharing options...
Malkey Posted April 21, 2008 Share Posted April 21, 2008 Try StringReplace($CurrentSearchCategories, @CRLF, "") Link to comment Share on other sites More sharing options...
litlmike Posted April 21, 2008 Author Share Posted April 21, 2008 Try StringReplace($CurrentSearchCategories, @CRLF, "")Well this did work, though it requires another step in the end, but that is okay. Any idea why my original attempt did not work? Should I report this is a possible bug? _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Malkey Posted April 21, 2008 Share Posted April 21, 2008 Well this did work, though it requires another step in the end, but that is okay. Any idea why my original attempt did not work? Should I report this is a possible bug?In the help file under StringStripWS, you originally had the flag 3 -a combination of flags 1 and 2.I suggested flag 8 whick stripped all white spaces. weaponx suggested flag 4. This works.Depending on what you want , changing the flag to 4 may be easier. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now