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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:22:28+00:00 2026-06-13T07:22:28+00:00

I have a string, string aString = a,aaa,aaaa,aaaaa,,,,,; Where i want to insert to

  • 0

I have a string,

string aString = "a,aaa,aaaa,aaaaa,,,,,";

Where i want to insert to a List..But when i do using the following method,

List<string> aList = new List<string>();

aList.AddRange(aString.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries));

MessageBox.Show(aList.Count.ToString());

I get the count as only 4, But there are actually 8 elements even the final characters in between the (,) sign is blank.

But if i pass the string as shown below,

string aString = "a,aaa,aaaa,aaaaa, , , , ,";

It will be shown as 8 elements..Please help me on this, the default way thw program retrieves the string is like so,

a,aaa,aaaa,aaaaa,,,,,

Please help on this one, It would be great if i could add spaces to the empty area or any other way so that i could add all these characters in between (,) sign to the list.. even the blank areas. Thank you 🙂

  • 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-13T07:22:30+00:00Added an answer on June 13, 2026 at 7:22 am

    Don’t use StringSplitOptions.RemoveEmptyEntries

    string aString = "a,aaa,aaaa,aaaaa,,,,,";
    var newStr = String.Join(", ", aString.Split(','));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following string in C#. aaa,bbbb.ccc|dddd:eee I then split it with new
I have the following function that does string splitting: on splitText(aString, delimiter) set retVal
I have a string like AAA 101 B202 C 303 and I want to
let's say I have a string like this: $str = "{aaa,aa,a,aaaaaaaa,aaaaaaa,aaaaaaa}"; I want to
I have a string: s = <aaa>bbb</ccc> I want to get aaa and bbb
I have a string that looks like string url = "www.example.com/aaa/bbb.jpg"; "www.example.com/" is 18
I have a string like this in C#: string a = A|B|C|D I want
I have a string and a list of objects: gpl = %(id)s : %(atr)s
So, I have a string of text: string with a bunch of links but
I have a string in php formatted like this: http://aaaaaaaaaa/*http://bbbbbbbbbbbbbbb where aaa... and bbb....

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.