How to split the last part of a string in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        string str = "c# c java c++ python php";
         
        string last = str.Substring(str.LastIndexOf(' ') + 1);
 
        Console.Write(last);
    }
}
 
 
 
 
/*
run:
 
php
 
*/

 



answered Aug 18, 2023 by avibootz

Related questions

1 answer 160 views
1 answer 124 views
124 views asked Aug 20, 2023 by avibootz
1 answer 149 views
1 answer 117 views
1 answer 117 views
1 answer 129 views
3 answers 408 views
...