• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/10

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

10 Cards in this Set

  • Front
  • Back
How do you find the first & last of a particular character?

firstComma = input.IndexOfAny(",".ToCharArray());


lastComma = input.LastIndexOfAny(",".ToCharArray());

How do you access the Substring?
lastName = index.Substring(start, length)
What are the Main() attributes?

NameParser myParse = new NameParser();


String nameToParse = "";


int menuChoice = 0;


String parsedName;

What are the cases in the while--switch/case loop?

case 1: Console.WriteLine("Please Enter a Name: ")


nameToParse = Console.ReadLine();


break;


case 2: if/else to put a name in the nameToParse


case 3: if/else to parse last name first


case 4: if/else to parses first name first


case 5: exit the program with Environment.Exit(0);

How to ensure the first character of each name is Capitalized?

var rgx = new Regex(@"\b[A-Z]", RegexOptions.IgnoreCase);


input = rgx.Replace(input, m => m.ToString().ToUpper());

How to count num commas?

int numCommas = input.Split(",").Length - 1;



How to handle 0 commas?

if statement then "restofName = input.Substring(0, lastSpace);


lastName = input.Substring(lastSpace + 1);


suffix = String.Empty;

How to handle 1 comma that occurs after the last space?

if (lastSpace < lastComma)


{


restofName = input.Substring(0, lastSpace);


lastName = input.Substring(firstSpace + 1, firstComma - firstSpace - 1);


suffix = input.Substring(lastComma + 1);


}

How to handle 1 comma that occurs before the last space?

if (lastSpace > lastComma)


{


lastName = input.Substring(0, firstComma);


restofName = input.Substring(lastComma + 1);


}

How to handle more than 1 comma?

lastName = input.Substring(0, firstComma);


restofName = input.Substring(firstComma + 1, lastComma - firstComma - 1);


suffix = input.Substring(lastComma + 1);