Torque Posted March 28, 2007 Posted March 28, 2007 Hello all,I need to delete all blank spaces (of different sizes) on the left of each line of a TXT file.I want to convert a txt file into an html file.The size of the file is unknow and here's a sample of the file :2855080 a217023eb21b13 17b52a36ee 40f ac5295c06579c (3 spaces) 53357 0f0647031b1ad70747 0b5f4b623b3f03b2ef1702 (5 spaces) 323488648 ef8ecb4f1648 6d94b72c48c0 0f219c2 ac82800cd (1 space) 9173 8a679f60738d79c7c47212d0b8713f59a1a4c d35 (6 spaces) 2976424 0308162ba61a18e179775 ab3eaf ca480928872d5 (3 spaces) 96 c055602291b390a3a7 cd05f6f1 10af53 2ea6aa81 (8 spaces) oÝ÷ Ù«¢+Ø(¥¹±Õ±ÐíÍÑÉ¥¹¹ÔÌÐì(ÀÌØí¥±ô¥±=Á¸ ÅÕ½ÐíÑÉ¥°¹ÑáÐÅÕ½Ðì°À¤(ì ¡¬¥¥±½Á¹½ÈÉ¥¹=,)%ÀÌØí¥±ô´ÄQ¡¸(5Í ½à À°ÅÕ½ÐíÉɽÈÅÕ½Ðì°ÅÕ½ÐíU¹±Ñ¼½Á¸¥±¸ÅÕ½Ðì¤(á¥Ð)¹%(ÀÌØí¡ÉÌô¥±I ÀÌØí¥±¤(ÀÌØí¡ÉÌÀôMÑÉ¥¹MÑÉ¥Á]L ÀÌØí¡Ḛ́Ĥ(ÀÌØí¡ÉÌÄôMÑÉ¥¹IáÁIÁ± ÀÌØí¡ÉÌÀ°ÅÕ½ÐìÀäÈíÈÅÕ½Ðì°ÅÕ½Ðì±ÐíÑÐì±Ðì½ÑÈÐìÅÕ½Ðì¤(ÀÌØí¡ÉÌÈôMÑÉ¥¹IáÁIÁ± ÀÌØí¡ÉÌİÅÕ½ÐìÀäÈíÅÕ½Ðì°ÅÕ½Ðì±ÐíÑÈÐì±ÐíÑÐìÅÕ½Ðì¤(ÀÌØí¡ÉÌÌôMÑÉ¥¹IáÁIÁ± ÀÌØí¡ÉÌȰÅÕ½ÐìÀäÈí¸ÅÕ½Ðì°ÅÕ½Ðì±ÐíÑÈÐì±ÐíÑÐìÅÕ½Ðì¤(ÀÌØíÉÍÕ±ÐôMÑÉ¥¹IáÁIÁ± ÀÌØí¡ÉḬ̀ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðì±Ðì½ÑÐì±ÐíÑÐìÅÕ½Ðì¤)5Í ½à À°ÅÕ½ÐíIÕ±ÈáÁÉÍÍ¥½¸IÁ±QÍÐÅÕ½Ðì°ÀÌØíÉÍձФ(It doesn't work on all lines but just on the first one.How can I do ?
herewasplato Posted March 28, 2007 Posted March 28, 2007 Maybe StringStripWS with flag 8. [size="1"][font="Arial"].[u].[/u][/font][/size]
Torque Posted March 28, 2007 Author Posted March 28, 2007 Maybe StringStripWS with flag 8.I don't want to delete all blank spaces of the file but just the blank spaces at the beginning of each line.
BigDod Posted March 28, 2007 Posted March 28, 2007 $file = FileOpen("trial.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $line1 = StringStripWS($line,1) MsgBox(0, "Line read:", $line1) Wend FileClose($file) Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
herewasplato Posted March 28, 2007 Posted March 28, 2007 I don't want to delete all blank spaces of the file but just the blank spaces at the beginning of each line.Sorry, I see that now in your OP.BigDod has show you the way and here is some more info:http://www.autoitscript.com/forum/index.ph...st&p=278955 [size="1"][font="Arial"].[u].[/u][/font][/size]
Torque Posted March 28, 2007 Author Posted March 28, 2007 Thank you very much for your quick answer BigDod, you're the best ! Now it works perfectly and I can go on working.
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