How to get the last two letters of a string in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        string s = "c# 9.0";
        
        Console.WriteLine(s.Substring(s.Length - 2));
    }
}




/*
run:

.0

*/

 



answered Nov 1, 2020 by avibootz

Related questions

1 answer 128 views
1 answer 146 views
1 answer 147 views
2 answers 242 views
1 answer 268 views
...