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?

Recommended Answers

All 2 Replies

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.

that works...thanks for your help =)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.