Helper for strings

This commit is contained in:
Marc Hernandez 2025-11-03 14:01:43 -08:00
parent 6b092f8a41
commit cb2b79be86

29
util/StringEx.cs Normal file
View File

@ -0,0 +1,29 @@
public static class StringEx
{
public static int LastIndexOfWithMax( this string str, char c, int maxChars )
{
var strEnd = str.Length - 1;
if( strEnd < 2 )
return -1;
for( int i = strEnd; i >= 0; i-- )
{
if( str[i] == c )
{
return i;
}
}
return -1;
}
}