zxzxzx Posted August 14, 2008 Posted August 14, 2008 Hi,I have this strings:Example:0,1,2,3,4,5,6,7,8,9,10,How to replace them like:http://wallcoo.com/film/2007_Shooter_Wallp...aper_2_1024.jpghttp://wallcoo.com/film/2007_Shooter_Wallp...per_10_1024.jpghttp://wallcoo.com/film/2007_Shooter_Wallp...aper_6_1024.jpghttp://wallcoo.com/film/2007_Shooter_Wallp...aper_7_1024.jpghttp://wallcoo.com/film/2007_Shooter_Wallp...aper_1_1024.jpghttp://wallcoo.com/film/2007_Shooter_Wallp...aper_4_1024.jpghttp://wallcoo.com/film/2007_Shooter_Wallp...aper_3_1024.jpghttp://wallcoo.com/film/2007_Shooter_Wallp...per_11_1024.jpghttp://wallcoo.com/film/2007_Shooter_Wallp...aper_5_1024.jpghttp://wallcoo.com/film/2007_Shooter_Wallp...aper_8_1024.jpghttp://wallcoo.com/film/2007_Shooter_Wallp...per_12_1024.jpgThank you
Andreik Posted August 14, 2008 Posted August 14, 2008 If the links is in a file (Ex:DOC.txt) #include <File.au3> $FILE = FileOpen(@ScriptDir & "\DOC.TXT",0) For $INDEX = 1 To _FileCountLines(@ScriptDir & "\DOC.TXT") $DATA = FileReadLine($FILE,$INDEX) $NAME = StringSplit($DATA,",") MsgBox(0,$INDEX,$NAME[2]) Next FileClose($FILE)
rasim Posted August 14, 2008 Posted August 14, 2008 (edited) zxzxzxTry this:$ReadFile = FileRead("c:\url.txt") $aStrings = StringSplit($ReadFile, @CR & @LF, 1) $hFile = FileOpen("c:\url.txt", 2) For $i = 1 To $aStrings[0] FileWriteLine($hFile, StringRegExpReplace($aStrings[$i], "^\d*,", "")) Next FileClose($hFile) Edited August 14, 2008 by rasim
Moderators SmOke_N Posted August 14, 2008 Moderators Posted August 14, 2008 zxzxzx Try this: $ReadFile = FileRead("c:\url.txt") $aStrings = StringSplit($ReadFile, @CR & @LF, 1) $hFile = FileOpen("c:\url.txt", 2) For $i = 1 To $aStrings[0] FileWriteLine($hFile, StringRegExpReplace($aStrings[$i], "^\d*,", "")) Next FileClose($hFile)oÝ÷ Ûú®¢×ßÙ¢Þ²Çʮ׫²Ú(vØZ´-j·jØ~ÚÂ¥zÚòx- Ú0¶Ê·ö÷°®+mz{aj×(uâ.׫²Ö§u»Ê¢é]vÂ+a¢ëZ)jëh×6Local $s_write = StringRegExpReplace(FileRead("c:\url.txt"), "(^|\n)(\d*,)", "\1") FileClose(FileOpen("c:\url.txt", 2)) FileWrite("c:\url.txt", $s_write) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
weaponx Posted August 14, 2008 Posted August 14, 2008 Probably wiser NOT to string split on comma since I believe commas are valid url characters.
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