vb.netwindows-phone

get last character in a string


I am new to developing windows phone apps. Now I am creating a text messenger app with T9 keyboard, I already made design like the buttons. Now what I want is how can I get the last character in a string? Example the string is "clyde", how can I get the char 'e' from that String? I am using Visual Basic as language.

UPDATE: Got it working now, I used this code:

string s = "clyde";
char e = s(s.Length-1);

Solution

  • I'm not sure about which language are you using, but in C# it is done like

    string s = "clyde";
    char e = s[s.Length-1];
    

    and it is very similar in every language.