Count words in an external file using delimiter of a spaceHow to efficiently count the number of keys/properties of an object in JavaScript?Count the number occurrences of a character in a stringHow can I count the occurrences of a list item?C# List<string> to string with delimiterSplit string with multiple delimiters in PythonReading Input File and Putting It Into An Array with Space Delimiter in PerlReading files with multiple delimiters in c++counting characters and lines from a file python 2.7Java recursive method for counting wordsCounting the number of spaces between words in a file using python?

Why is the marginal distribution/marginal probability described as "marginal"?

Resistor Selection to retain same brightness in LED PWM circuit

Can I pay my credit card?

Thread.sleep inside infinite while loop doesn't throw exception - why?

How can I make dummy text (like lipsum) grey?

Assign the same string to multiple variables

Why is it correct to use ~た in this sentence, even though we're talking about next week?

Is Precocious Apprentice enough for Mystic Theurge?

Why do academics prefer Mac/Linux?

Why doesn't Iron Man's action affect this person in Endgame?

Why did the soldiers of the North disobey Jon?

Why use a retrograde orbit?

What would a Dragon have to exhale to cause rain?

When the match time is called, does the current turn end immediately?

Why are there five extra turns in tournament Magic?

How does this piece of code determine array size without using sizeof( )?

Polynomial division: Is this trick obvious?

A person lacking money who shows off a lot

What dog breeds survive the apocalypse for generations?

bash: Counting characters within multiple files

Do we see some Unsullied doing this in S08E05?

Can EU citizens work on Iceland?

Is Big Ben visible from the British museum?

Why didn't Daenerys' advisers suggest assassinating Cersei?



Count words in an external file using delimiter of a space


How to efficiently count the number of keys/properties of an object in JavaScript?Count the number occurrences of a character in a stringHow can I count the occurrences of a list item?C# List<string> to string with delimiterSplit string with multiple delimiters in PythonReading Input File and Putting It Into An Array with Space Delimiter in PerlReading files with multiple delimiters in c++counting characters and lines from a file python 2.7Java recursive method for counting wordsCounting the number of spaces between words in a file using python?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I want to calculate the number of words in a text file using a delimiter of a space (" "), however I am struggling.



Dim counter = 0
Dim delim = " "
Dim fields() As String
fields = Nothing

Dim line As String
line = Input

While (SR.EndOfStream)
line = SR.ReadLine()

End While

Console.WriteLine(vbLf & "Reading File.. ")

fields = line.Split(delim.ToCharArray())
For i = 0 To fields.Length
counter = counter + 1

Next

SR.Close()
Console.WriteLine(vbLf & "The word count is 0", counter)


I do not know how to open the file and to get the do this, very confused; would like an explanation so I can edit and understand from it.










share|improve this question
























  • It looks like you will be able to use the first example in the StreamReader Class documentation to help you complete the code you have started.

    – Andrew Morton
    Mar 23 at 16:12











  • Or File.ReadAllText. You don't need to specify a delimiter if the delimiter is a space (char 32): it's the default separator. That's pretty much all you need.

    – Jimi
    Mar 23 at 16:14











  • @jimi, hi how would i do that the link you provided was in C im new to this so how would i write it inot VB

    – loco3424
    Mar 23 at 17:40











  • It's in C#, C++, F# and VB.Net. In the upper-right side of the page you can find the language selector.

    – Jimi
    Mar 23 at 17:47












  • @jimi Dim path As String = "z:test.txt" Dim length = Len(path) Console.WriteLine(length) , i did this is this correct not working

    – loco3424
    Mar 23 at 18:49


















0















I want to calculate the number of words in a text file using a delimiter of a space (" "), however I am struggling.



Dim counter = 0
Dim delim = " "
Dim fields() As String
fields = Nothing

Dim line As String
line = Input

While (SR.EndOfStream)
line = SR.ReadLine()

End While

Console.WriteLine(vbLf & "Reading File.. ")

fields = line.Split(delim.ToCharArray())
For i = 0 To fields.Length
counter = counter + 1

Next

SR.Close()
Console.WriteLine(vbLf & "The word count is 0", counter)


I do not know how to open the file and to get the do this, very confused; would like an explanation so I can edit and understand from it.










share|improve this question
























  • It looks like you will be able to use the first example in the StreamReader Class documentation to help you complete the code you have started.

    – Andrew Morton
    Mar 23 at 16:12











  • Or File.ReadAllText. You don't need to specify a delimiter if the delimiter is a space (char 32): it's the default separator. That's pretty much all you need.

    – Jimi
    Mar 23 at 16:14











  • @jimi, hi how would i do that the link you provided was in C im new to this so how would i write it inot VB

    – loco3424
    Mar 23 at 17:40











  • It's in C#, C++, F# and VB.Net. In the upper-right side of the page you can find the language selector.

    – Jimi
    Mar 23 at 17:47












  • @jimi Dim path As String = "z:test.txt" Dim length = Len(path) Console.WriteLine(length) , i did this is this correct not working

    – loco3424
    Mar 23 at 18:49














0












0








0








I want to calculate the number of words in a text file using a delimiter of a space (" "), however I am struggling.



Dim counter = 0
Dim delim = " "
Dim fields() As String
fields = Nothing

Dim line As String
line = Input

While (SR.EndOfStream)
line = SR.ReadLine()

End While

Console.WriteLine(vbLf & "Reading File.. ")

fields = line.Split(delim.ToCharArray())
For i = 0 To fields.Length
counter = counter + 1

Next

SR.Close()
Console.WriteLine(vbLf & "The word count is 0", counter)


I do not know how to open the file and to get the do this, very confused; would like an explanation so I can edit and understand from it.










share|improve this question
















I want to calculate the number of words in a text file using a delimiter of a space (" "), however I am struggling.



Dim counter = 0
Dim delim = " "
Dim fields() As String
fields = Nothing

Dim line As String
line = Input

While (SR.EndOfStream)
line = SR.ReadLine()

End While

Console.WriteLine(vbLf & "Reading File.. ")

fields = line.Split(delim.ToCharArray())
For i = 0 To fields.Length
counter = counter + 1

Next

SR.Close()
Console.WriteLine(vbLf & "The word count is 0", counter)


I do not know how to open the file and to get the do this, very confused; would like an explanation so I can edit and understand from it.







vb.net count character delimiter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 19:49









Andrew Morton

16.3k63553




16.3k63553










asked Mar 23 at 16:01









loco3424loco3424

104




104












  • It looks like you will be able to use the first example in the StreamReader Class documentation to help you complete the code you have started.

    – Andrew Morton
    Mar 23 at 16:12











  • Or File.ReadAllText. You don't need to specify a delimiter if the delimiter is a space (char 32): it's the default separator. That's pretty much all you need.

    – Jimi
    Mar 23 at 16:14











  • @jimi, hi how would i do that the link you provided was in C im new to this so how would i write it inot VB

    – loco3424
    Mar 23 at 17:40











  • It's in C#, C++, F# and VB.Net. In the upper-right side of the page you can find the language selector.

    – Jimi
    Mar 23 at 17:47












  • @jimi Dim path As String = "z:test.txt" Dim length = Len(path) Console.WriteLine(length) , i did this is this correct not working

    – loco3424
    Mar 23 at 18:49


















  • It looks like you will be able to use the first example in the StreamReader Class documentation to help you complete the code you have started.

    – Andrew Morton
    Mar 23 at 16:12











  • Or File.ReadAllText. You don't need to specify a delimiter if the delimiter is a space (char 32): it's the default separator. That's pretty much all you need.

    – Jimi
    Mar 23 at 16:14











  • @jimi, hi how would i do that the link you provided was in C im new to this so how would i write it inot VB

    – loco3424
    Mar 23 at 17:40











  • It's in C#, C++, F# and VB.Net. In the upper-right side of the page you can find the language selector.

    – Jimi
    Mar 23 at 17:47












  • @jimi Dim path As String = "z:test.txt" Dim length = Len(path) Console.WriteLine(length) , i did this is this correct not working

    – loco3424
    Mar 23 at 18:49

















It looks like you will be able to use the first example in the StreamReader Class documentation to help you complete the code you have started.

– Andrew Morton
Mar 23 at 16:12





It looks like you will be able to use the first example in the StreamReader Class documentation to help you complete the code you have started.

– Andrew Morton
Mar 23 at 16:12













Or File.ReadAllText. You don't need to specify a delimiter if the delimiter is a space (char 32): it's the default separator. That's pretty much all you need.

– Jimi
Mar 23 at 16:14





Or File.ReadAllText. You don't need to specify a delimiter if the delimiter is a space (char 32): it's the default separator. That's pretty much all you need.

– Jimi
Mar 23 at 16:14













@jimi, hi how would i do that the link you provided was in C im new to this so how would i write it inot VB

– loco3424
Mar 23 at 17:40





@jimi, hi how would i do that the link you provided was in C im new to this so how would i write it inot VB

– loco3424
Mar 23 at 17:40













It's in C#, C++, F# and VB.Net. In the upper-right side of the page you can find the language selector.

– Jimi
Mar 23 at 17:47






It's in C#, C++, F# and VB.Net. In the upper-right side of the page you can find the language selector.

– Jimi
Mar 23 at 17:47














@jimi Dim path As String = "z:test.txt" Dim length = Len(path) Console.WriteLine(length) , i did this is this correct not working

– loco3424
Mar 23 at 18:49






@jimi Dim path As String = "z:test.txt" Dim length = Len(path) Console.WriteLine(length) , i did this is this correct not working

– loco3424
Mar 23 at 18:49













3 Answers
3






active

oldest

votes


















1














You're going to be reading a file as the source of the data, so let's create a variable to refer to its filename:



Dim srcFile = "C:temptwolines.txt"


As you have shown already, a variable is needed to hold the number of words found:



Dim counter = 0


To read from the file, a StreamReader will do the job. Now, we look at the documenation for it (yes, really) and notice that it has a Dispose method. That means that we have to explicitly dispose of it after we've used it to make sure that no system resources are tied up until the computer is next rebooted (e.g there could be a "memory leak"). Fortunately, there is the Using construct to take care of that for us:



Using sr As New StreamReader(srcFile)


And now we want to iterate over the content of the file line-by-line until the end of the file:



 While Not sr.EndOfStream


Then we want to read a line and find how many items separated by spaces it has:



 counter += sr.ReadLine().Split(" "c, StringSplitOptions.RemoveEmptyEntries).Length


The += operator is like saying "add n to a" instead of saying "a = a + n". The " "c is a literal array of the character " "c. The c tells it that is a character and not a string of one character. The StringSplitOptions.RemoveEmptyEntries means that if there was text of "one two" then it would ignore the extra spaces.



So, if you were writing a console program, it might look like:



Imports System.IO

Module Module1

Sub Main()

Dim srcFile = "C:temptwolines.txt"
Dim counter = 0

Using sr As New StreamReader(srcFile)
While Not sr.EndOfStream
counter += sr.ReadLine().Split(" "c, StringSplitOptions.RemoveEmptyEntries).Length
End While
End Using

Console.WriteLine(counter)
Console.ReadLine()

End Sub

End Module


Any embellishments such as writing out what the number represents or error checking are left up to you.






share|improve this answer
































    0














    With Path.Combine you don't have to worry about where the slashes or back slashes go. You can get the path of special folders easily using the Environment class. The File class of System.IO is shared so you don't have to create an instance.



    Public Sub Main()
    Dim p As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Chapters.txt")
    Debug.Print(Environment.SpecialFolder.MyDocuments.ToString)
    Dim count As Integer = GetCount(p)
    Console.WriteLine(count)
    Console.ReadKey()
    End Sub
    Private Function GetCount(Path As String) As Integer
    Dim s = File.ReadAllText(Path)
    Return s.Split().Length
    End Function





    share|improve this answer






























      -1














      Use Split function, then Directly get the length of result array and add 1 to it.






      share|improve this answer


















      • 1





        The OP has that part done, it is the "i do not know how to open the file" part which is the problem.

        – Andrew Morton
        Mar 23 at 16:47











      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55315643%2fcount-words-in-an-external-file-using-delimiter-of-a-space%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      You're going to be reading a file as the source of the data, so let's create a variable to refer to its filename:



      Dim srcFile = "C:temptwolines.txt"


      As you have shown already, a variable is needed to hold the number of words found:



      Dim counter = 0


      To read from the file, a StreamReader will do the job. Now, we look at the documenation for it (yes, really) and notice that it has a Dispose method. That means that we have to explicitly dispose of it after we've used it to make sure that no system resources are tied up until the computer is next rebooted (e.g there could be a "memory leak"). Fortunately, there is the Using construct to take care of that for us:



      Using sr As New StreamReader(srcFile)


      And now we want to iterate over the content of the file line-by-line until the end of the file:



       While Not sr.EndOfStream


      Then we want to read a line and find how many items separated by spaces it has:



       counter += sr.ReadLine().Split(" "c, StringSplitOptions.RemoveEmptyEntries).Length


      The += operator is like saying "add n to a" instead of saying "a = a + n". The " "c is a literal array of the character " "c. The c tells it that is a character and not a string of one character. The StringSplitOptions.RemoveEmptyEntries means that if there was text of "one two" then it would ignore the extra spaces.



      So, if you were writing a console program, it might look like:



      Imports System.IO

      Module Module1

      Sub Main()

      Dim srcFile = "C:temptwolines.txt"
      Dim counter = 0

      Using sr As New StreamReader(srcFile)
      While Not sr.EndOfStream
      counter += sr.ReadLine().Split(" "c, StringSplitOptions.RemoveEmptyEntries).Length
      End While
      End Using

      Console.WriteLine(counter)
      Console.ReadLine()

      End Sub

      End Module


      Any embellishments such as writing out what the number represents or error checking are left up to you.






      share|improve this answer





























        1














        You're going to be reading a file as the source of the data, so let's create a variable to refer to its filename:



        Dim srcFile = "C:temptwolines.txt"


        As you have shown already, a variable is needed to hold the number of words found:



        Dim counter = 0


        To read from the file, a StreamReader will do the job. Now, we look at the documenation for it (yes, really) and notice that it has a Dispose method. That means that we have to explicitly dispose of it after we've used it to make sure that no system resources are tied up until the computer is next rebooted (e.g there could be a "memory leak"). Fortunately, there is the Using construct to take care of that for us:



        Using sr As New StreamReader(srcFile)


        And now we want to iterate over the content of the file line-by-line until the end of the file:



         While Not sr.EndOfStream


        Then we want to read a line and find how many items separated by spaces it has:



         counter += sr.ReadLine().Split(" "c, StringSplitOptions.RemoveEmptyEntries).Length


        The += operator is like saying "add n to a" instead of saying "a = a + n". The " "c is a literal array of the character " "c. The c tells it that is a character and not a string of one character. The StringSplitOptions.RemoveEmptyEntries means that if there was text of "one two" then it would ignore the extra spaces.



        So, if you were writing a console program, it might look like:



        Imports System.IO

        Module Module1

        Sub Main()

        Dim srcFile = "C:temptwolines.txt"
        Dim counter = 0

        Using sr As New StreamReader(srcFile)
        While Not sr.EndOfStream
        counter += sr.ReadLine().Split(" "c, StringSplitOptions.RemoveEmptyEntries).Length
        End While
        End Using

        Console.WriteLine(counter)
        Console.ReadLine()

        End Sub

        End Module


        Any embellishments such as writing out what the number represents or error checking are left up to you.






        share|improve this answer



























          1












          1








          1







          You're going to be reading a file as the source of the data, so let's create a variable to refer to its filename:



          Dim srcFile = "C:temptwolines.txt"


          As you have shown already, a variable is needed to hold the number of words found:



          Dim counter = 0


          To read from the file, a StreamReader will do the job. Now, we look at the documenation for it (yes, really) and notice that it has a Dispose method. That means that we have to explicitly dispose of it after we've used it to make sure that no system resources are tied up until the computer is next rebooted (e.g there could be a "memory leak"). Fortunately, there is the Using construct to take care of that for us:



          Using sr As New StreamReader(srcFile)


          And now we want to iterate over the content of the file line-by-line until the end of the file:



           While Not sr.EndOfStream


          Then we want to read a line and find how many items separated by spaces it has:



           counter += sr.ReadLine().Split(" "c, StringSplitOptions.RemoveEmptyEntries).Length


          The += operator is like saying "add n to a" instead of saying "a = a + n". The " "c is a literal array of the character " "c. The c tells it that is a character and not a string of one character. The StringSplitOptions.RemoveEmptyEntries means that if there was text of "one two" then it would ignore the extra spaces.



          So, if you were writing a console program, it might look like:



          Imports System.IO

          Module Module1

          Sub Main()

          Dim srcFile = "C:temptwolines.txt"
          Dim counter = 0

          Using sr As New StreamReader(srcFile)
          While Not sr.EndOfStream
          counter += sr.ReadLine().Split(" "c, StringSplitOptions.RemoveEmptyEntries).Length
          End While
          End Using

          Console.WriteLine(counter)
          Console.ReadLine()

          End Sub

          End Module


          Any embellishments such as writing out what the number represents or error checking are left up to you.






          share|improve this answer















          You're going to be reading a file as the source of the data, so let's create a variable to refer to its filename:



          Dim srcFile = "C:temptwolines.txt"


          As you have shown already, a variable is needed to hold the number of words found:



          Dim counter = 0


          To read from the file, a StreamReader will do the job. Now, we look at the documenation for it (yes, really) and notice that it has a Dispose method. That means that we have to explicitly dispose of it after we've used it to make sure that no system resources are tied up until the computer is next rebooted (e.g there could be a "memory leak"). Fortunately, there is the Using construct to take care of that for us:



          Using sr As New StreamReader(srcFile)


          And now we want to iterate over the content of the file line-by-line until the end of the file:



           While Not sr.EndOfStream


          Then we want to read a line and find how many items separated by spaces it has:



           counter += sr.ReadLine().Split(" "c, StringSplitOptions.RemoveEmptyEntries).Length


          The += operator is like saying "add n to a" instead of saying "a = a + n". The " "c is a literal array of the character " "c. The c tells it that is a character and not a string of one character. The StringSplitOptions.RemoveEmptyEntries means that if there was text of "one two" then it would ignore the extra spaces.



          So, if you were writing a console program, it might look like:



          Imports System.IO

          Module Module1

          Sub Main()

          Dim srcFile = "C:temptwolines.txt"
          Dim counter = 0

          Using sr As New StreamReader(srcFile)
          While Not sr.EndOfStream
          counter += sr.ReadLine().Split(" "c, StringSplitOptions.RemoveEmptyEntries).Length
          End While
          End Using

          Console.WriteLine(counter)
          Console.ReadLine()

          End Sub

          End Module


          Any embellishments such as writing out what the number represents or error checking are left up to you.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 23 at 19:50

























          answered Mar 23 at 19:39









          Andrew MortonAndrew Morton

          16.3k63553




          16.3k63553























              0














              With Path.Combine you don't have to worry about where the slashes or back slashes go. You can get the path of special folders easily using the Environment class. The File class of System.IO is shared so you don't have to create an instance.



              Public Sub Main()
              Dim p As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Chapters.txt")
              Debug.Print(Environment.SpecialFolder.MyDocuments.ToString)
              Dim count As Integer = GetCount(p)
              Console.WriteLine(count)
              Console.ReadKey()
              End Sub
              Private Function GetCount(Path As String) As Integer
              Dim s = File.ReadAllText(Path)
              Return s.Split().Length
              End Function





              share|improve this answer



























                0














                With Path.Combine you don't have to worry about where the slashes or back slashes go. You can get the path of special folders easily using the Environment class. The File class of System.IO is shared so you don't have to create an instance.



                Public Sub Main()
                Dim p As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Chapters.txt")
                Debug.Print(Environment.SpecialFolder.MyDocuments.ToString)
                Dim count As Integer = GetCount(p)
                Console.WriteLine(count)
                Console.ReadKey()
                End Sub
                Private Function GetCount(Path As String) As Integer
                Dim s = File.ReadAllText(Path)
                Return s.Split().Length
                End Function





                share|improve this answer

























                  0












                  0








                  0







                  With Path.Combine you don't have to worry about where the slashes or back slashes go. You can get the path of special folders easily using the Environment class. The File class of System.IO is shared so you don't have to create an instance.



                  Public Sub Main()
                  Dim p As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Chapters.txt")
                  Debug.Print(Environment.SpecialFolder.MyDocuments.ToString)
                  Dim count As Integer = GetCount(p)
                  Console.WriteLine(count)
                  Console.ReadKey()
                  End Sub
                  Private Function GetCount(Path As String) As Integer
                  Dim s = File.ReadAllText(Path)
                  Return s.Split().Length
                  End Function





                  share|improve this answer













                  With Path.Combine you don't have to worry about where the slashes or back slashes go. You can get the path of special folders easily using the Environment class. The File class of System.IO is shared so you don't have to create an instance.



                  Public Sub Main()
                  Dim p As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Chapters.txt")
                  Debug.Print(Environment.SpecialFolder.MyDocuments.ToString)
                  Dim count As Integer = GetCount(p)
                  Console.WriteLine(count)
                  Console.ReadKey()
                  End Sub
                  Private Function GetCount(Path As String) As Integer
                  Dim s = File.ReadAllText(Path)
                  Return s.Split().Length
                  End Function






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 24 at 2:00









                  MaryMary

                  4,5112921




                  4,5112921





















                      -1














                      Use Split function, then Directly get the length of result array and add 1 to it.






                      share|improve this answer


















                      • 1





                        The OP has that part done, it is the "i do not know how to open the file" part which is the problem.

                        – Andrew Morton
                        Mar 23 at 16:47















                      -1














                      Use Split function, then Directly get the length of result array and add 1 to it.






                      share|improve this answer


















                      • 1





                        The OP has that part done, it is the "i do not know how to open the file" part which is the problem.

                        – Andrew Morton
                        Mar 23 at 16:47













                      -1












                      -1








                      -1







                      Use Split function, then Directly get the length of result array and add 1 to it.






                      share|improve this answer













                      Use Split function, then Directly get the length of result array and add 1 to it.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Mar 23 at 16:22









                      Saumitra TopinkattiSaumitra Topinkatti

                      395




                      395







                      • 1





                        The OP has that part done, it is the "i do not know how to open the file" part which is the problem.

                        – Andrew Morton
                        Mar 23 at 16:47












                      • 1





                        The OP has that part done, it is the "i do not know how to open the file" part which is the problem.

                        – Andrew Morton
                        Mar 23 at 16:47







                      1




                      1





                      The OP has that part done, it is the "i do not know how to open the file" part which is the problem.

                      – Andrew Morton
                      Mar 23 at 16:47





                      The OP has that part done, it is the "i do not know how to open the file" part which is the problem.

                      – Andrew Morton
                      Mar 23 at 16:47

















                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55315643%2fcount-words-in-an-external-file-using-delimiter-of-a-space%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                      용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                      155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해