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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:22:43+00:00 2026-05-21T19:22:43+00:00

I have a string coming in the format: div, v6571, 0, div, v8173, 300,

  • 0

I have a string coming in the format:

div, v6571, 0, div, v8173, 300, p, v1832, 400

I want to split this string into multiple arrays, for the example above I would need 3 arrays, such that the format would be like this:

item[0] -> div
item[1] -> v6571
item[2] -> 0

I know that I can just do a .Split(',') on the string and put it into an array, but that’s one big array. For the string example above I would need 3 arrays with the structure provided above. Just getting a bit confused on the iteration over the string!

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-21T19:22:43+00:00Added an answer on May 21, 2026 at 7:22 pm

    I’m not sure exactly what you’re looking for, but to turn the above into three separate arrays, I’d do something like:

    var primeArray = yourString.Split(,);
    List<string[]> arrays = new List<string[]>();
    for(int i = 0; i < primeArray.Length; i += 3)
    {
      var first = primeArray[i];
      var second = primeArray[i+1];
      var third = primeArray[i+2];
    
      arrays.Add(new string[] {first, second, third});
    }
    

    Then you can iterate through your list of string arrays and do whatever.

    This does assume that all of your string arrays will always be three strings long- if not, you’ll need to do a foreach on that primeArray and marshal your arrays more manually.

    Here’s the exact code I used. Note that it doesn’t really change anything from my original non-compiled version:

    var stringToSplit = "div, v6571, 0, div, v8173, 300, p, v1832, 400";
    List<string[]> arrays = new List<string[]>();
    var primeArray = stringToSplit.Split(',');
    for (int i = 0; i < primeArray.Length; i += 3)
    {
       var first = primeArray[i];
       var second = primeArray[i + 1];
       var third = primeArray[i + 2];
       arrays.Add(new string[] { first, second, third });
    }
    

    When I check this in debug, it does have all three expected arrays.

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

Sidebar

Related Questions

I have one JSON that is coming in a string format. I need to
I have string like this /c SomeText\MoreText Some Text\More Text\Lol SomeText I want to
I have to validate the format of a date string coming from a csv
I have a string coming from a table like can no pay{1},as your payment{2}due
I have string that I want to chop to array of substrings of given
Imagine I have String in C#: I Don’t see ya.. I want to remove
I have this string 'john smith~123 Street~Apt 4~New York~NY~12345' Using JavaScript, what is the
I have a string value coming from a label in the .aspx page as
I have the following JSON string coming from external input source: {value: "82363549923gnyh49c9djl239pjm01223", id:
I have a HTML string in ISO-8859-1 encoding. I need to pass this 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.