Community
    • Login

    ASCII Sort Order

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 2 Posters 21 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L Online
      leestwise
      last edited by

      I have a need to sort lines in ASCII sort order. Is there a way to do this in Notepad++?
      …lee

      Notepad++ v8.9 (64-bit)
      Build time: Dec 27 2025 - 14:28:33
      Scintilla/Lexilla included: 5.5.8/5.4.6
      Boost Regex included: 1_85
      TinyXML-2 included: 11.0.0
      nlohmann JSON included: 3.12.0
      Path: C:\Program Files\Notepad++\notepad++.exe
      Command Line: “C:\Program Files\Notepad++\localization\english.xml”
      Admin mode: OFF
      Local Conf mode: OFF
      Cloud Config: OFF
      Periodic Backup: ON
      Placeholders: OFF
      Scintilla Rendering Mode: SC_TECHNOLOGY_DEFAULT (0)
      Multi-instance Mode: monoInst
      asNotepad: OFF
      File Status Auto-Detection: cdEnabledNew (for current file/tab only)
      Dark Mode: OFF
      Display Info:
      primary monitor: 1920x1080, scaling 100%
      visible monitors count: 1
      installed Display Class adapters:
      0000: Description - AMD Radeon™ 860M Graphics
      0000: DriverVersion - 32.0.22068.0
      OS Name: Windows 11 Pro (64-bit)
      OS Version: 25H2
      OS Build: 26200.9168
      Current ANSI codepage: 1252
      Plugins:
      ComparePlugin (2.0.2)
      ComparePlus (2.2)
      mimeTools (3.1)
      NppConverter (4.7)
      NppExport (0.4)
      SessionMgr (1.4.4)

      1 Reply Last reply Reply Quote 0
      • PeterJonesP Online
        PeterJones
        last edited by

        By “ASCII” sort, I am assuming you mean A-Z comes before a-z. If so, that is known as “lexicographical” sort, which is one of the many sorting options in the Edit > Line Operations menu

        L 1 Reply Last reply Reply Quote 1
        • L Online
          leestwise @PeterJones
          last edited by

          @PeterJones, that much is true, but not true enough. ASCII sort order is the order in which the ASCII characters are coded from ASCII 32 (space) to ASCII 127 (~). This is the order I need:
          ! " # $ % & ’ ( ) * + , - . / digits : ; < = > ? @ ALPHA [ \ ] ^ _ ` alpha { | } ~

          …lee

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP Online
            PeterJones @leestwise
            last edited by PeterJones

            @leestwise ,

            Lexicographical sorts by codepoint. Which, in your limited terminology, could be considred “ASCII”: technically, that’s only “ASCII” if you are still using 7-bit encoding… which you aren’t, and which hasn’t been really used since before the 80s (even in the 80s, when they still used the label “ASCII”, it was actually an 8-bit encoding which overlapped with ASCII for the first 128 codepoints)

            So if I start with the random order of the characters that you showed in your list on the left of the image, then apply lexicographical sorting will result in the order on the left, which is exactly what you want.

            6319df59-bb8d-490f-96b7-50f73724bd00-image.jpeg

            It would have taken less time for you to try that and see that my answer matched your needs than to complain to me that my answer was wrong, let alone to wait for me to run the experiment for you.


            update: fixed the image: the first time, it copied your ’ as the smartquote ’ instead of the ASCII ', so it sorted later (because smart-single-quote has a later codepoint than any character from the ASCII set). I didn’t notice until after I’d posted that it put the smart ’ at the end of the list; that was caused by a limitation of the forum, not of Notepad++'s sorting

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors