[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jedit-users
Subject:    Re: [ jEdit-users ] OT:Possible to eliminate duplicate text with
From:       Slava Pestov <slava () jedit ! org>
Date:       2002-12-24 23:09:34
[Download RAW message or body]

A simple macro should do the trick:

b = new StringBuffer();
line = null;
for(i = 0; i < buffer.getLineCount(); i++)
{
  nextLine = buffer.getLineText(i);
  if(!nextLine.equals(line))
  {
    b.append(nextLine);
    b.append('\n');
    line = nextLine;
  }
}

jEdit.newFile(view).insert(0,b.toString());

I haven't tested this so YMMV.

On Mon, 2002-12-23 at 11:04, Simon Moore wrote:
> I'm sorry if this is OT but I thought I'd ask anyway as regexp questions
> have cropped up before. 
> 
> Is it possible to find and thus eliminate duplicate text using jedit's
> regexp/beanshell searching abilitities (if possible case insensitive).
> 
> ie.
> 
> I have text like so:
> 
> The rain in spain lies mainly on the plain.
> The rain in spain lies mainly on the plain.
> The rain in Italy lies mainly on the plain.
> The fox jumped over the gate.
> The fox jumped over the gate.
> 
> I want to be able to get this:
> 
> The rain in spain lies mainly on the plain.
> The rain in Italy lies mainly on the plain.
> The fox jumped over the gate.
> 
> Thanks...
> 
> Saimon
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> -- 
> -----------------------------------------------
> jEdit Users' List
> jEdit-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jedit-users
-- 
Slava Pestov



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
-- 
-----------------------------------------------
jEdit Users' List
jEdit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jedit-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic