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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:03:37+00:00 2026-05-30T11:03:37+00:00

Newbie still learning, been trying to search and hack code together for hours now,

  • 0

Newbie still learning, been trying to search and hack code together for hours now, I think there’s something fundamental I’m not getting!

Okay so,I have a string (taken from a text file) – “user1,password,1,0;user2,password,0,0;user3,password,0,0;user4,password,0,0”

I want to split the string into a multidimensional array(I think)

userAccount[1]= 
    accountDetails[userName]=user1
    accountDetails[password]=password
    accountDetails[adminRights]=1
    accountDetails[loginAttempts]=0
userAccount[2]=
    accountDetails[userName]=user2
...So on and so on

I’d like to use an enum for accountDetails for readability aswell but I can get that working after.

What is the best way of creating this multidimensional array from the string?

Lots thanks in advance,
Ross

  • 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-30T11:03:38+00:00Added an answer on May 30, 2026 at 11:03 am

    As others suggested, creating a class for the data would be a better choice than a multidimensional “array”.

    The class could look like this:

    class UserAccount
    {
        public string UserName { get; set; }
        public string Password { get; set; }
        public bool HasAdminRights { get; set; }
        public int LoginAttempts { get; set; }
    }
    

    And you could then parse the string using string.Split() first for ; and then in each part for ,. Using LINQ it could look like this:

    string line = …;
    
    var users = (from userString in line.Split(';')
                 select userString.Split(',') into parts
                 select new UserAccount
                 {
                    UserName = parts[0],
                    Password = parts[1],
                    HasAdminRights = int.Parse(parts[2]) != 0,
                    LoginAttempts = int.Parse(parts[3])
                 }).ToArray();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a jquery newbie... still learning the framework.... and here goes my query... The
Newbie to C++ learning by converting a java program to c++. The following code
This is really a dumb newbie question, but I am still learning the ropes
Still a newbie here, forgive me. I'm trying to make a button that will
Still the newbie in Scala and I'm now looking for a way to implement
Still a rails and ruby newbie, and I'm trying to figure out why adding
I am still a newbie to Haskell and I think I am over my
I am still working on this and I been trying to add in different
Sorry still learning Yii so newbie question. I have a site im converting over
I'm a newbie to web technology, and still on a learning curve. Heard that,

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.