Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
EASY Task?
#1
Heart 
Dear all,

I am new to Quick Macros and I love this program by now. As trying to play with it I got the following issue. I got a string from my macro that contains a duplicated string. I need to detect those and delete the second part. How to do it?

str s = "repeatable stringrepeatable string"
int n
for n 0 s.len
    out s.left(s n)

Even the for loop does not work... Why? How to find a solution?

Best regards

Gregor Heart
#2
Quote:I am new to Quick Macros

Try LibreAutomate. It is similar to Quick Macros.

-----

Easy if the substring is known.
Example in LibreAutomate:

Code:
Copy      Help
// script ""
string s = "repeatable stringrepeatable string";
if (s.RxFindAll(@"repeatable string", out var matches) && matches.Length > 1) {
    for (int i = matches.Length; --i >= 1; ) {
        var m = matches[i];
        s = s.Remove(m.Start..m.End);
    }
}

print.it(s);


Forum Jump:


Users browsing this thread: 1 Guest(s)