Jump to content

strings question...


Marius
 Share

Recommended Posts

Hey! B)

I have a question here:

How do I replace in string 5 lines of text, if I know only the first line, and want to replace next 4 lines after it?

I have a string wich contains @CRLFs:

(sometext & @CRLF & line1 & @CRLF & line2 & @CRLF & line3 & @CRLF & line4 & @CRLF & line5 & @CRLF & someothertext)

Ok,now the funniest part:

let's say I know only the line1 of string. And I need to replace in string this line and 4 more lines after it:

(sometext & @CRLF & newline1 & @CRLF & newline2 & @CRLF & newline3 & @CRLF & newline4 & @CRLF & newline5 & @CRLF & someothertext)

Edited by Marius
Marius back in da hood! :)
Link to comment
Share on other sites

put it into an array then you can do what you need to do pretty easy

$a_lines = StringSplit("sometext & @CRLF & line1 & @CRLF & line2 & @CRLF & line3 & @CRLF & line4 & @CRLF & line5 & @CRLF & someothertext",@CRLF,1)

for $x = 1 to $a_lines[0]

; do what you need to do.

next

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...