string to search for value
element value to find
start index
number of elements to examine
the index of the first element with value "value" or the index of the last examined element + 1
test!("==")(StringSearch!().locateChar("Hello", 'l', 5, size_t.max), 5); test!("==")(StringSearch!().locateChar("Hello", 'l', 2, size_t.max), 2); test!("==")(StringSearch!().locateChar("Hello", 'l', 3, size_t.max), 3); test!("==")(StringSearch!().locateChar("Hello", 'o', 5, size_t.max), 5); test!("==")(StringSearch!().locateChar("Hello", 'o', 4, size_t.max), 4); test!("==")(StringSearch!().locateChar("Hello", 'o', 0, size_t.max), 4); // Test searches in a limited region of the input string test!("==")(StringSearch!().locateChar("Hello", 'l', 0, 0), 0); test!("==")(StringSearch!().locateChar("Hello", 'l', 0, 2), 2); test!("==")(StringSearch!().locateChar("Hello", 'l', 0, 3), 2);
Locates the first occurence of value within the first length characters of str. If greater, length is truncated to the length of str.