Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8073993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:30:50+00:00 2026-06-05T14:30:50+00:00

For example I’ve got a text file that I’ve put into an array and

  • 0

For example I’ve got a text file that I’ve put into an array and then I have split that array by the full stops (so each sentence is in its own index of the new array) using the following:

textSplitArray = textArray[j].Split('.');

How would I then count the number of words in each index of textSplitArray to determine which sentence has the most words? Is it possible to do this or would I have to do it another way?

I’ve tried searching everywhere but can’t seem to find an answer

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:30:52+00:00Added an answer on June 5, 2026 at 2:30 pm

    If you want to know which sentence is the longest (i.e. contains maximum words) use

    var result = textSplitArray.OrderByDescending(x => x.Split(' ').Length)
                               .FirstOrDefault();
    

    And if you want to know number of words in that longest sentence, use

    int Max = textSplitArray.Max(x => x.Split(' ').Length);
    

    OR

    int Max = result.Length;
    

    Since every two words in a sentence can be separated by space, that’s why i have split each sentence based on ' ' space.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
Example I have this array: @packages = [2, [4, 2, 1], 4, [4,2], [5,
Example here: http://jsfiddle.net/KyW6c/2/ I have an ordered list. Each list item is a project
Example client put this on their website <script type=text/javascript src=http://domain.com/banner.php?bid=123&affid=88></script> In my banner.php how
Example: $ objdump Logger.cpp.o -t 00000000 g F .text 00000000 .hidden __sti___10_Logger_cpp_0b2ae32b
Example: copy in one tmux pane (via vim), then switch to another pane (running
Example: an Employee table with an optional DateOfBirth field can be normalized into two
Example: var sessions = require('sessions'); function load_session(req) { sessions.load(sid); } Now that the session
Example, I have billions of short phrases, and I want to clusters of them
Example I have: @test = Pakke.find([[4], [5]]) In my Pakke table I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.