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 143 views
3 answers 393 views
1 answer 113 views
113 views asked Aug 20, 2023 by avibootz
1 answer 139 views
1 answer 108 views
1 answer 106 views
1 answer 122 views
...