Hi,
If I have a string, how can I get the string without the last character and then convert it to an integer?
Thank you
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Apr 11, 2012, 9:31 AM
s = s.Substring(0,1)
or to get it as a char:
char c = s[0];
VulpesPosted Apr 12, 2012, 5:39 AM
Sam HobbsPosted Apr 11, 2012, 8:16 PM
VulpesPosted Apr 11, 2012, 5:32 PM
Sam HobbsPosted Apr 11, 2012, 3:44 PM
sabinePosted Apr 11, 2012, 9:24 AM
And if I want to read the first letter of a string?
VulpesPosted Apr 11, 2012, 9:00 AM