I want to be able to check for a specific character within a string that the location is being pointed at. For example in Java you would do if (b.charAt(bPointer) == '#')
expect i'm coding in c#. I'm wondering if i possibly should be using the contains()
method or indexOf()
method or is there a different way I'm suppose to be doing this.
public static bool func(string a, string b)
{
int aPointer = a.Length - 1;
int bPointer = b.Length - 1;
int aSkips = 0;
int bSkips = 0;
while(aPointer >= 0 || bPointer >=0)
{
while (aPointer >= 0)
{
if (// check if a.CharAt(aPointer) =='#' )
{
aSkips += 1;
aPointer -= 1;
}
else if (aSkips > 0)
{
aPointer -= 1;
aSkips -= 1;
}
else
{
break;
}
}
while (bPointer >= 0)
{
if ()
{
bSkips += 1;
bPointer -= 1;
}
else if (bSkips > 0)
{
bPointer -= 1;
bSkips -= 1;
}
else
{
break;
}
}