Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
replace line
#2
Create new member function str.ReplaceLineN and paste this code:

Code:
Copy      Help
function# $replacement lineindex

;Replaces specified line.
;Returns index of first character of n-th line, or -1 if n is too big.


;replacement - replacement string.
;lineindex - zero-based line index.


;EXAMPLE
;str s="zero[]one[]two"
;s.ReplaceLineN("ONE" 1)
;out s



int i=findl(this lineindex)
if(i>=0)
,int j=findcs(this "[]" i)
,this.replace(replacement i iif(j>=0 j-i -1))
ret i


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)