styles3000 Posted December 22, 2009 Share Posted December 22, 2009 I've been looking within the help files and ran across StringStripWS ( "string", flag )I've tried StringStripWS(aRecords, 8) and StringStripWS(aRecords[$x], 8) but it wasn't takin the space out. #include <file.au3> _CreateTaggedKeywords() Func _CreateTaggedKeywords() Dim $aRecords $PthFile = 'D:\Rename.txt' ;Full path and filename to read $outputFileName = 'D:\New Text Document (2).txt' If Not _FileReadToArray($PthFile,$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf $file = FileOpen($outputFileName, 2) For $x = 1 to $aRecords[0] FileWriteLine($file,'<a href="'&$aRecords[$x]&'.htm">'&$aRecords[$x]&'</a><BR>'&@CRLF) Next FileClose($file) EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted December 22, 2009 Developers Share Posted December 22, 2009 Don't see it used in the code. What did you try? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 22, 2009 Moderators Share Posted December 22, 2009 styles3000, Works fine for me: $sText = 'D:\New Text Document (2).txt' ConsoleWrite(StringStripWS($stext, 8) & @CRLF) Did you use the right flags? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
weaponx Posted December 22, 2009 Share Posted December 22, 2009 I'm going to guess he called the function without subsequently assigning it's output. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 22, 2009 Moderators Share Posted December 22, 2009 weaponx,Having done that myself when I first used that type of String* function, I am quite prepared to believe that could be the solution. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
styles3000 Posted December 22, 2009 Author Share Posted December 22, 2009 The output is looking like this... <a href="banco patagonia .htm">banco patagonia </a><BR> <a href="aig stock .htm">aig stock </a><BR> <a href="optionsxpress .htm">optionsxpress </a><BR> <a href="colonial bank .htm">colonial bank </a><BR> <a href="banco estado .htm">banco estado </a><BR> <a href="aig .htm">aig </a><BR> Do you see the white space before .htm? I've tried ..... $PthFile = 'D:\New Text Document (2).txt' ConsoleWrite(StringStripWS($PthFile, 8) & @CRLF) I've tried.... $outputFileName = 'D:\New Text Document (2).txt' ConsoleWrite(StringStripWS($outputFileName, 8) & @CRLF) I've tried.... $file = 'D:\New Text Document (2).txt' ConsoleWrite(StringStripWS($file, 8) & @CRLF) Maybe I'm approaching things the wrong way? Or placing the function in the wrong place. Func _CreateTaggedKeywords() Dim $aRecords $PthFile = 'D:\Rename.txt' ;Full path and filename to read $outputFileName = 'D:\New Text Document (2).txt' If Not _FileReadToArray($PthFile,$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf $file = FileOpen($outputFileName, 2) For $x = 1 to $aRecords[0] FileWriteLine($file,'<a href="'&$aRecords[$x]&'.htm">'&$aRecords[$x]&'</a><BR>'&@CRLF) Next $PthFile = 'D:\New Text Document (2).txt' ConsoleWrite(StringStripWS($PthFile, 4) & @CRLF) FileClose($file) EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted December 22, 2009 Developers Share Posted December 22, 2009 $PthFile = 'D:\New Text Document (2).txt' ConsoleWrite(StringStripWS($PthFile, 8) & @CRLF) This work fine for me.... all spaced are gone or are you expecting something else? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 22, 2009 Moderators Share Posted December 22, 2009 styles3000,The ConsoleWrite was just to show you that it worked! Not a suggestion for your code!You need to go to wherever you get your 'D:\New Text Document (2).txt' from and use the StringStripWS before you get to your function:$outputFileName = 'D:\New Text Document (2).txt' $outputFileName = StringStripWS(outputFileName , 8)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
styles3000 Posted December 22, 2009 Author Share Posted December 22, 2009 $PthFile = 'D:\New Text Document (2).txt' ConsoleWrite(StringStripWS($PthFile, 8) & @CRLF) This work fine for me.... all spaced are gone or are you expecting something else? Yes Jos, Maybe I am. I'm getting this below...... <a href="banco patagonia .htm">banco patagonia </a><BR> <a href="aig stock .htm">aig stock </a><BR> <a href="optionsxpress .htm">optionsxpress </a><BR> <a href="colonial bank .htm">colonial bank </a><BR> <a href="banco estado .htm">banco estado </a><BR> <a href="aig .htm">aig </a><BR> but I want this...... <a href="banco-patagonia.htm">banco patagonia </a><BR> <a href="aig-stock.htm">aig stock </a><BR> <a href="optionsxpress.htm">optionsxpress </a><BR> <a href="colonial-bank.htm">colonial bank </a><BR> <a href="banco-estado.htm">banco estado </a><BR> <a href="aig.htm">aig </a><BR> I'll review over all that yall have gave me....Thanks for all your help..... Link to comment Share on other sites More sharing options...
jchd Posted December 22, 2009 Share Posted December 22, 2009 Maybe I am. I'm getting this below...... <a href="banco patagonia .htm">banco patagonia </a><BR> <a href="aig stock .htm">aig stock </a><BR> <a href="optionsxpress .htm">optionsxpress </a><BR> <a href="colonial bank .htm">colonial bank </a><BR> <a href="banco estado .htm">banco estado </a><BR> <a href="aig .htm">aig </a><BR> but I want this...... <a href="banco-patagonia.htm">banco patagonia </a><BR> <a href="aig-stock.htm">aig stock </a><BR> <a href="optionsxpress.htm">optionsxpress </a><BR> <a href="colonial-bank.htm">colonial bank </a><BR> <a href="banco-estado.htm">banco estado </a><BR> <a href="aig.htm">aig </a><BR> I'll review over all that yall have gave me....Thanks for all your help..... Hi, What others are trying to tell you is that you need to _assign_ the result of StringStripWS($PthFile, 8) to some variable. But wait a minute: aren't you trying to apply the function to the filename that contains the records you want to process? StringStripWS($PthFile, 8) will simply return the contents of variable $PthFile with whitespaces removed. It won't open the file and butcherize the strings inside it! Try this: Func _CreateTaggedKeywords() Dim $aRecords $PthFile = 'D:\Rename.txt' ;Full path and filename to read $outputFileName = 'D:\New Text Document (2).txt' If Not _FileReadToArray($PthFile,$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf $file = FileOpen($outputFileName, 2) For $x = 1 to $aRecords[0] FileWriteLine($file,'<a href="'&StringStripWS($aRecords[$x], 4)&'.htm">'&$aRecords[$x]&'</a><BR>'&@CRLF) Next FileClose($file) EndFunc But even then, notice that 'banco patagonia ' won't change to 'banco-patagonia'. You need to use something like StringReplace in addition to the WS strip to convert middle space to hyphen. That or use one call to StringRegexpReplace to do it all in one shot. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) 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