Hi, I am trying to make a program which outputs an Invoice Number, which consists of the first 3 letters of a person's first name and the last 3 digits of their zip code. The user enter their first and last name, then enters their city, state, and zip such as:

Name: Billy Jones

City, State, Zip: Chicago, Illinois 42349

Therefore, the invoice would look like:

Invoice: Bil349

I can get the first 3 letters of the first name fine using the substring function, but I have been stumped on how to get past all of the text to get the last 3 digits of the zip code entered.

Any Suggestions?

6 Years
Discussion Span
Last Post by xcarbonx

Try this(assuming that the code is saved in the variable str):

str.Substring(str.Length - 3)

Will give you the last three characters of the code.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.