How to use LastIndexOfAny() to search a string for multiple characters from the right (reverse) in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = "c# c c++ java";

            int i = s.LastIndexOfAny(new char[] { 'v', 'j' });
            
            Console.WriteLine(i);
        }
    }
}


/*
run:

11

*/

 



answered Mar 7, 2017 by avibootz

Related questions

...