Community
    • Login

    Word Count?

    Scheduled Pinned Locked Moved General Discussion
    5 Posts 5 Posters 1.6k Views 1 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.
    • osgaldorO Offline
      osgaldor
      last edited by

      Does N++ currently have a word count function? I like to use the editor to help me flesh out story ideas and a word count function would be very helpful for me. If there is not specifically defined function like this, is it possible to simulate it?

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • CoisesC Offline
        Coises
        last edited by Coises

        Edit: See correct answer in Alan’s reply.

        No built-in function, but this should work:

        Select Search | Find…

        Enter:
        Find what: \b\w+\b
        and be sure Regular expression is selected at the bottom;
        then click Count.

        Potential errors in this method: Words with internal hyphens, apostrophes, diagonals or other punctuation will be counted as multiple words. Numbers will be counted as words; if they contain commas or periods, as multiple words.

        Edit:

        I made that more difficult than necessary.
        Find what: \S+
        works by counting every string of characters that doesn’t include a space or a line break as a word. That’s probably what you want. (Note that is a capital S.)

        1 Reply Last reply Reply Quote 1
        • Mark OlsonM Offline
          Mark Olson
          last edited by

          See my response to issue #1336, which is the Notepad++ issue in which someone first asked for such a feature.

          1 Reply Last reply Reply Quote 0
          • Alan KilbornA Offline
            Alan Kilborn @osgaldor
            last edited by Alan Kilborn

            @osgaldor

            A count of words is available in the View menu’s Summary command.

            1 Reply Last reply Reply Quote 2
            • guy038G Online
              guy038
              last edited by

              Hi, @osgaldor, @coises, @mark-olson, @alan-kilborn and All,

              @mark-olson, I suppose that, in your recent wordcount.py script, on GitHub, the part :

                  curline = editor.lineFromPosition(curloc)
                  curcol = editor.getColumn(curloc) 
              

              should be changed as :

                  curline = editor.lineFromPosition(curloc) + 1
                  curcol = editor.getColumn(curloc) + 1
              

              Best Regards,

              guy038

              1 Reply Last reply Reply Quote 1

              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