22 Replies
i need to separate name from toppings and price
to then create an instance of an item
ive managed to separate the name
but how would I make a substring from the first comma to the £ sign
I'd probably write a parser instead tbh
i need to get the toppings back into a list
If not that, then split by
,
first
First element will be the nameto create my item
Then split last element by
' '
And the last part of that element will be the pricebut theres multiple whitespaces
before the £ sign
Yeah, but the last segment will be the price
tomato sauce has a space
and i dont want to split that
You just split it to extract the price
intPriceTemp = intPriceTemp.Remove(intPriceTemp.IndexOf("£"));
intPriceTemp = intPriceTemp.Remove(intPriceTemp.IndexOf("."));
im getting an error
am i supposed to have 2 arguments
inside .remove
i only want to remove that specific character
Look the method up in the documentation, see what the other parameter is
i know now but
its still saying my index numbers are invalid
'line 90' = string toppings = temp.Substring(nameLength, temp.IndexOf("£"));
i dont get it
my index values should be valid
Use the debugger to see what they actually are
how do i do that
$debug
Tutorial: Debug C# code and inspect data - Visual Studio (Windows)
Learn features of the Visual Studio debugger and how to start the debugger, step through code, and inspect data in a C# application.
looks fine to me?
starting index is nameLength 10
then end index is £ sign
which is near end of temp
anyone got an idea