b.bracket = gegexpr("\\[", ped)[[1]]
this basically just creates an array in b.bracket that holds the index positions of all '[' in a string.
I also come across this sort of thing:
some.index = b.bracket[b.bracket > 0]
this creates an array in some.index with all values of b.bracket that are greater then zero.
my question: is there an efficient way to code this in C#? My code seems to contain a ridiculous amount of looping and inefficiency:
List<int> l_bracket_index_numbers = new List<int>();
for (count_incidents_S = 0; count_incidents_S < (len); count_incidents_S++)
{
symbol_index = new_ped.IndexOf(lbracket, count_incidents_S);
if (symbol_index != -1) //last character
{
l_bracket_index_numbers.Add(symbol_index);
}
}
List<int> l_bracket_index_numbers_nd = l_bracket_index_numbers.Distinct().ToList();
Final_Result_lb = l_bracket_index_numbers_nd;


Sign In
Create Account


Back to top









