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?
Jump to Post
Use 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
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.