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 8711493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:53:32+00:00 2026-06-13T04:53:32+00:00

Possible Duplicate: First split then join a subset of a string I’m trying to

  • 0

Possible Duplicate:
First split then join a subset of a string

I’m trying to split a string into an array, take first element out (use it) and then join the rest of the array into a seperate string.

Example:

theString = "Some Very Large String Here"

Would become:

theArray = [ "Some", "Very", "Large", "String", "Here" ]

Then I want to set the first element in a variable and use it later on.

Then I want to join the rest of the array into a new string.

So it would become:

firstElem = "Some";
restOfArray = "Very Large String Here"

I know I can use theArray[0] for the first element, but how would I concatinate the rest of the array to a new string?

  • 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-13T04:53:33+00:00Added an answer on June 13, 2026 at 4:53 am

    You can use string.Split and string.Join:

    string theString = "Some Very Large String Here";
    var array = theString.Split(' ');
    string firstElem = array.First();
    string restOfArray = string.Join(" ", array.Skip(1));
    

    If you know you always only want to split off the first element, you can use:

    var array = theString.Split(' ', 2);
    

    This makes it so you don’t have to join:

    string restOfArray = array[1];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to split string into array as integers I have a 3x2
Possible Duplicate: string split in c# How to split Name string into First Name
Possible Duplicate: Get first element of array Convert array to string php I have
Possible Duplicate: Get first element of an array What is the fastest and easiest
Possible Duplicate: [].slice or Array.prototype.slice the first (function() { var slice = Array.prototype.slice, aArguments
Possible Duplicate: Replace only first match using preg_replace I have a string as follows:
Possible Duplicate: Shorten String in PHP (full words only) How to get first x
Possible Duplicate: How to capitalize first letter of each sentence? public static string CapitalizeEachWord(this
Possible Duplicate: Splitting a string in C++ Im trying to create a function that
Possible Duplicate: How to split string preserving whole words? I have the following string:

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.