This is a simple newbie question. I could probably figure this out using some complicated method of string like substring and other methods but I was wondering if there is a better way to do this.
Say I have a string in C#:
string foo = "°F";
What is best way to break that into two different strings where I have “deg” and “F”?
I see what was happening. stackflow was interpreting the HTML. It is actually (ampersand)deg(semicolon)F.
Sorry folks it was late when I posted that last night.
I dunno if it’s “complicated” but:
I feel like you’ve chosen an overly simple example though. Are you really dealing with a two character string, or are you trying to do something more interesting?
Update: Well, I still think you must be trying to do something harder here. But here’s another way: (hat tip: @James Didzun)
Or you could do:
Or:
Or:
Or:
Personally, I prefer this last approach. Why are you splitting a string that you know the EXACT contents of?