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

Re: [NTB] Sorting inline numbers

Expand Messages
  • Stephen
    Hi Amitava, I have a clip which starts what you want, but you will probably want it tweaked a bit more. It uses the kind of raw sorting which considers 116 to
    Message 1 of 2 , Apr 30 10:54 PM
    View Source
    • 0 Attachment
      Hi Amitava,
      I have a clip which starts what you want, but you will probably want it
      tweaked a bit more.
      It uses the kind of raw sorting which considers 116 to be a smaller
      number than 18. It works great with alphabetical values but looks wierd
      to us with numeric stuff.
      I can think of several ways to go from here. Probably the easiest would
      be to assign the %temp% variable to an array and writing your own
      sorting algorithm (sp?) which gives your prefered value, or this might
      get you near enough that you can manually drag and drop your numbers
      into order. Course someone else could already have the perfect clip out
      there somewhere.

      H="sort comma delimited list"
      ^!Set %temp%=^$GetSelection$
      ^!Set %temp%=^$StrReplace(", ";"^%NL%";^%temp%;FALSE;FALSE)$
      ^!Set %temp%=^$StrSort("^%temp%";FALSE;TRUE;FALSE)$
      ^!Set %temp%=^$StrReplace("^%NL%";", ";^%temp%;FALSE;FALSE)$
      ^%temp%

      VSNL MAIL wrote:
      As a result, all the numbers in the list are not in any order. I
      > have given an example below.
      >
      > Damodardeva 18, 69, 100, 366, 111, 213, 261, 370, 116, 153, 303, 363
      >
      > Can anybody suggest a clip which would sort the numbers in ascending order.
      >
      > Thanks,
      > Amitava
      >
      >
    • Adrian/ Rosemary Worsfold
      Don t think I m on the clips list so just replying. This does work, but again not for numbers. The clip that should precede it would find the longest number
      Message 2 of 2 , May 1, 2001
      View Source
      • 0 Attachment
        Don't think I'm on the clips list so just replying. This does work, but
        again not for numbers. The clip that should precede it would find the
        longest number before a comma, count it and add zeros in front of all
        others to so that all numbers were the same number of digits. Beyond me.

        H="Sort comma delimited list"
        ^!Keyboard CTRL+A
        ^!Replace " " >> "" [HAS]
        ^!Replace "," >> "^P" [HAS]
        ^!Keyboard SHIFT+CTRL+J
        ^!Keyboard ALT+M L S A
        ^!Keyboard CTRL+END

        Add from clipboard.

        Adrian Worsfold

        http://www.pluralist.co.uk


        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.