-
strings
I have been sitting here for 2 hours trying to figure out this ##!!?!?!? problem
I am VERY VERY stressed and annoyed
I was to retrieve the last character of this string "]2"
HOW do I do it? everytime I do it, I either get an exception or I get the same string returned back to me
string test = data.Substring(data.LastIndexOf("]", data.LastIndexOf("]"), 1));
?!?!?!?!?!!?
-
Re: strings
No need to put the length of the character since you're getting the last character
you could do substring such as this one
string test = data.substring(data.length -1).tostring()
-
Re: strings
If you want the last character of a string then do as mar_zim says, although you don't need the call to ToString at the end because Substring returns a String object already. If you want all the characters after the last occurrence of "]" regardless how many characters that is, us this:
Code:
string test = data.Substring(data.LastIndexOf(']') + 1);
-
Re: strings
URGH... completly forgot about it