Loading ...
Sorry, an error occurred while loading the content.

145RE: [NTS] Re: Sorting Numbers and No-Sort: Remove Dups/Trips...

Expand Messages
  • h.paulissen@facburfdcw.unimaas.nl
    Nov 8, 2002
      Jody, Sheri,

      Now I am awake...

      Here is a better clip to sort, you may be away for now, Jody, but you'll
      catch it up later...

      The Label is named Second because it was my second attempt...

      ------------------------------------------
      ^!SetScreenUpdate OFF
      ^!Jump 1
      :SECOND
      ^!Find "\d+\:\d+" RS
      ^!IfError SORT
      ^!Set %stringsize%=^$strSize(^$GetSelection$)$
      ^!Set %break%=^$StrPos(":";^$GetSelection$;True)$
      ^!Set %rightpart%=^$Calc(^%stringsize%-^%break%)$
      ^!Set %leftpart%=^$Calc(^%break%-1)$
      ^!Set %string%=^$GetSelection$
      ^!If ^%leftpart%<3 LeadingZeroLEFT ELSE LeadingZeroRIGHT
      ^!GoTo Second
      :LeadingZeroLEFT
      ^!Set
      %string%=^$StrInsert("^$StrFill(0;^$Calc(3-^%leftpart%)$)$";"^%string%";0)$
      :LeadingZeroRIGHT
      ^!If ^%rightpart%>3 Second
      ^!InsertText
      ^$StrInsert("^$StrFill(0;^$Calc(3-^%rightpart%)$)$";"^%string%";5)$
      ^!GoTo Second
      :SORT
      ^!Select ALL
      ^$StrSort("^$GetSelection$";False;True;True)$
      ^!Replace "0+{\d+}" >> "\1" RAW
      ------------------------------------------

      Sheri, your clip seems to have some problems with inserting the text at the
      proper place. I didn't study it, but when run on the lines Jody provided us
      with I got some strange results...

      1:99
      13:3
      13:15

      14:315:5-6

      15:6
      15:815:11
      15:13
      15:18

      16:416:23
      16:27
      17:28

      18:7120:002
      126:002
      140:003
      141:003

      Bye,

      Hugo

      >
    • Show all 26 messages in this topic