RaspberryMatic
RaspberryMatic copied to clipboard
ReGaHss: Enhancement for Find() method
Is it possible to enhance the find
-method of string
?
I would need a Find
that finds the n-th occurrence of a key in a string, e.g.:
string test = "<td>key</td><td>value</td>"; integer pos = test.Find("<td>", 2);
Result should be 12 in this example.
Other find-variants like find-n-th-occ-in-a-substring would be great to prevent that substrings must be copied into temporary strings, especially as hmscript has some problems with the memory management if strings are used extensively.
Proposal for method:
string.Find(string key, integer min_index, integer max_index, integer nr_occurrence)