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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:26:14+00:00 2026-06-18T15:26:14+00:00

I must be tired because this should be simple. I am trying to find

  • 0

I must be tired because this should be simple. I am trying to find the values passed into my program from the command line.

Here’s the code:

private static bool ParseParms(IEnumerable<string> parms)
{

  try
  {
  foreach (var s in parms)
  {
    if (!s.Contains(":")) continue;
    var split = s.Split(Convert.ToChar(":"));
    if (split.Count() != 2) continue;
    Console.WriteLine("split[0]: " + split[0]);
    Console.WriteLine("split[1]: " + split[1]);
    switch (s[0].ToString())
    {
        // branch
      case "b":
        CustomerInfo.Branch = split[1];
        break;

        // account
      case "a":
        CustomerInfo.AccountNumber = split[1];
        break;

        //name
      case "n":
        CustomerInfo.Name = split[1];
        break;

        //street
      case "str":
        CustomerInfo.Street = split[1];
        break;

        // city
      case "c":
        CustomerInfo.City = split[1];
        break;

        // state
      case "st":
        CustomerInfo.State = split[1];
        break;

        // street
      case "z":
        CustomerInfo.Zip = split[1];
        break;

    }

  }

  Console.WriteLine("=======================");
  Console.WriteLine("name: " + CustomerInfo.Name);
  Console.WriteLine("br: " + CustomerInfo.Branch);
  Console.WriteLine("acctno: " + CustomerInfo.AccountNumber);
  Console.WriteLine("street: " + CustomerInfo.Street);
  Console.WriteLine("city: " + CustomerInfo.City);
  Console.WriteLine("state: " + CustomerInfo.State);
  Console.WriteLine("zip: " + CustomerInfo.Zip);
  Console.WriteLine("=======================");


  if(string.IsNullOrWhiteSpace(CustomerInfo.Branch) || string.IsNullOrWhiteSpace(CustomerInfo.AccountNumber))
  {
    return false;
  }
  return true;
  }
  catch (Exception ex)
  {
    Console.WriteLine("Error: " + ex.Message);
    return false;
  }
}

This is what I’m passing in:

“b:01” “a:012345” “n:John Doe” “str:123 Street” “st:AL” “c:Bessemer” “z:35020”

The is the console from the debug:

split[0]: b
split[1]: 01
split[0]: a
split[1]: 012345
split[0]: n
split[1]: John Doe
split[0]: str
split[1]: 123 Street
split[0]: st
split[1]: AL
split[0]: c
split[1]: Bessemer
split[0]: z
split[1]: 35020

This is the results:

=======================
name: John Doe
br: 01
acctno: 012345
street: 
city: Bessemer
state: 
zip: 35020
=======================

As you can see, the street and state are blank and I can’t figure out why…

Halp!

  • 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-18T15:26:15+00:00Added an answer on June 18, 2026 at 3:26 pm

    The Problem was just a typo. You typed

    switch (s[0].ToString())
    

    instead of

    switch (split[0].ToString())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried the solution from this thread , but I must be missing something
There must be a simple solution to this problem but for the love of
This must be a very stupid question because nobody else is asking it. I'm
This must be quite simple (and probably a dupe), but I am not seeing
First, this is a programming question because I'm trying to set up a test/QA
I tried searching for information on this, but must not know the right terms
Must be a way looping through this code: private void loadSprites() { this.sprites[0] =
Must Support IE6 and must Validate vs XHTML Strict 1.0! This is tricky to
I know this is a simple question, so hopefully it won't be a bother
I have a simple game that I'm trying to do for learning purposes, but

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.