legend Posted September 12, 2015 Share Posted September 12, 2015 Hello,How would I replace something after a string?Example:SourceFiles0=C:\Users\flox\Desktop\build\So I want to replace everything in this line that comes after: SourceFiles0= Link to comment Share on other sites More sharing options...
Danyfirex Posted September 12, 2015 Share Posted September 12, 2015 I suppose that you know SourceFiles0= so. Why not add new string to that. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
l3ill Posted September 12, 2015 Share Posted September 12, 2015 $var="SourceFiles0=C:\Users\flox\Desktop\build\" $iCnt = StringLen("SourceFiles0=") ConsoleWrite("$iCnt = " & $iCnt & @CRLF) $varCut = StringLeft($var, $iCnt) ConsoleWrite("$varCut = " & $varCut & @CRLF) $newString = $varCut & " Something Else" ConsoleWrite("$newString = " & $newString & @CRLF) My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
legend Posted September 12, 2015 Author Share Posted September 12, 2015 (edited) I need to replace a string in a file.so I need to replace: SourceFiles0=C:\Users\flox\Desktop\build\with just: SourceFiles0= (I don't know at what line number SourceFiles0=C:\Users\flox\Desktop\build\) are Edited September 12, 2015 by legend Link to comment Share on other sites More sharing options...
Danyfirex Posted September 12, 2015 Share Posted September 12, 2015 something like:Local $aFile=FileReadToArray("file.txt") For $i=0 to UBound($aFile)-1 If StringInStr($aFile[$i],"SourceFiles0=") Then $aFile[$i]="SourceFiles0=" & "Replacestringhere" EndIf FileWrite("newfile.txt",$aFile[$i] & @CRLF) NextSaludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
legend Posted September 12, 2015 Author Share Posted September 12, 2015 Thank's the was just what i needed 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