Will66 Posted April 25, 2007 Share Posted April 25, 2007 (edited) No Trim function? the script below is converting large html files to prepare for using in an autoit functions. for example a line in like "space space space space<link rel="stylesheet" href="docs/style.css" type="text/css"> space space space space" with lots leading and trailing spaces.....how to clean them out best way please? #include<Array.au3> #include<File.au3> Dim $a_Test,$b_result ; Read file into array _FileReadToArray("C:\Program Files\AutoIt3\beta\Will\openwysiwygv1.4.6cWill\exampleWill.html",$a_Test) For $line = 1 to UBound($a_Test)-1 If StringLen($a_Test[$line]) > 0 Then $a_Test[$line]= StringRegExpReplace($a_Test[$line], " ", "") ;If StringInStr($a_Test[$line], " ") Then $a_Test[$line]=StringReplace($a_Test[$line], " ","") If StringInStr($a_Test[$line], """") Then $a_Test[$line]=StringReplace($a_Test[$line], """","""""") $a_Test[$line]="$temp &= """ & $a_Test[$line] & """ & @CRLF" ;MsgBox(0,"",$a_Test[$line]) EndIf Next ;;_ArrayReverse($a_Test,1) ; write reversed array to file _FileWriteFromArray("test2.txt",$a_Test,1) Edited April 25, 2007 by Will66 Link to comment Share on other sites More sharing options...
BrettF Posted April 25, 2007 Share Posted April 25, 2007 I think what you're looking for is StringStripWS () Check it out in the helpfile Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Will66 Posted April 25, 2007 Author Share Posted April 25, 2007 thanx, did the trick........ its annoying that stuff like that doesn't come up under the Related links of (for eg) StringReplace function in the help file. Link to comment Share on other sites More sharing options...
xcal Posted April 25, 2007 Share Posted April 25, 2007 All the string functions start with "String" so you could scan the index in the help file. Or, under Search, putting in "spaces" returns StringStripWS as the first result. How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
Will66 Posted April 25, 2007 Author Share Posted April 25, 2007 (edited) All the string functions start with "String" so you could scan the index in the help file. Or, under Search, putting in "spaces" returns StringStripWS as the first result.certainly does, I was searching like "replace" and "trim"......not listed in either of those searches.....I expected it to be related. Edited April 25, 2007 by Will66 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