I am trying to write a program that will tell me how many calories are in a certain number of eggs, cups of flour, cups of sugar, etc. I have a set number of calories for each of the items (i.e. each egg has 72 calories), but I ask the user to input in a textbox how many of each item the recipe calls for. After they input the quantity, I put the item they chose into a listbox followed by a hyphen and the quantity (i.e. eggs (each) - 2). What I need help with is being able to get the computer to determine where the hyphen is in that String and then reading whatever is following the hyphen into a Double value. Is this even possible?
macdunk11
0
Newbie Poster
Recommended Answers
Jump to PostUse the Split method. It takes a string and a delimiter and returns an array of tokes split at the delimiter. For example
Dim test As String = "The-quick-brown-fox" Dim tokens() As String = test.Split("-")
results in tokens being assigned as follows
tokens(0) = …
All 4 Replies
Reverend Jim
4,678
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
macdunk11
0
Newbie Poster
Reverend Jim
4,678
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
kingsonprisonic
42
Posting Whiz in Training
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.