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

  • SEARCH
  • Home
  • 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 393371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:15:03+00:00 2026-05-12T16:15:03+00:00

ok, so ill cut to the chase here. and to be clear, im looking

  • 0

ok, so ill cut to the chase here. and to be clear, im looking for code examples where possible.

so, i have a normal string, lets say,

string mystring = "this is my string i want to use";

ok, now that i have my string, i split it by the space with

string[] splitArray = mystring.Split(new char[] { ' ' });

ok, so now i have splitArray[0] through splitArray[7].
now, i need to do some fancy things with the string that i normally wouldnt need to do.
here are a few:

i need to cut off the first word, so i am left with the other 7 words, so that i have something like:

string myfirstword = "this";
mystring = "is my string i want to use";

now, i will need to use mystring over and over again, using different parts of it at different times, and depending on the string i will have no idea how long, it will be. so i will give some examples of things ill need.

first, ill need to know, how many words are there (this is easy, just throwing it in)
second, ill need some way of using things like,

string secondword = splitArray[1];
string everythingAfterTheSecondWord = splitArray[2+];

if you noticed, i included a [2+] … the + indicating that i want all strings in the array put back together, spaces in all, into a string. so for example,

string examplestring = "this is my example for my stack overflow question";
string[] splitArray2 = examplestring.Split(new char[] { ' ' });

now, if i called on splitArray2[4+] i would want a return of “for my stack overflow question”. now obviously its not as simple as adding a + to a string array.. but thats what i need, and under the current situation i have tried many other easier ways that simply to not work.

ALSO, if i called on something like splitArray2[2-5] i would want, words 2 through 5 obviously.

Summary:
i need greater management of my string[] arrays, and i need to be able to find, every word after word *, need to be able to strip out random words in the string while leaving the rest of the string intact, and need to be able to find string m through n

Thanks!

  • 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-05-12T16:15:03+00:00Added an answer on May 12, 2026 at 4:15 pm

    Most of what you’re looking for can be achieved with a List<string>. Briefly:

    string mystring = "this is my string i want to use";
    
    List<string> splitArray = new List<string>(mystring.Split(new char[] { ' ' }));
    string firstWord = splitArray[0];
    
    // mystring2 = "is my string i want to use"
    splitArray.RemoveAt(0);
    string mystring2 = String.Join(" ", splitArray.ToArray());
    

    To do the more complicated things you describe with splitArray[2+] requires LINQ though, and hence .NET 3.5.

    List<string> everythingAfterTheSecondWord = splitArray.Skip(2).ToList();
    

    For splitArray[2-5]:

    List<string> arraySlice = splitArray.Skip(2).Take(3).ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Heys! Ill cut right to the subject, here's the jquery code: jQuery(function() { jQuery('.entry-content
I'll cut to the chase. I have two questions about switch that are simple,
So I'll spare you the giant blocks of code and cut to the chase.
ill have an if statement if (int1 < int2) {} else {} I want
Ill first tell you what I am doing. I have three activities in the
I really think that here ill found my answers... I try to make a
I dont think this is possible in c# but ill post it anyway. Given
I'll cut to the chase to save you all some boredom of surplus reading:
I'll cut right to the chase. Right now I am developing a web based
I have already cut everything I could from the main loop. I also optimized

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.