I am trying to figure out what is wrong with LastDelimiter function.
This code take a String from a comboBox and extract the ID inside a bracket pair.
Also variable pos which read the LastDelimiter + 1 should return 5.
But pos is 10 (which is exactly (or coincidently) the length of the catStr.
Also the next ExtractSubstr should return an error or empty string. But the result is correct
567.
Where does the magic come from?
// catStr := cbCategories.Items[cbCategories.ItemIndex];
// catStr:= 'SOFTEX (1900)';
catStr:= '0123(567)9';
pos:=LastDelimiter('(', catStr)+1;
catID:= ExtractSubstr(catStr, pos,[')']);
ShowMessage('String = ' + catStr + '. ( found at ' + intToStr(pos) + '. Subword is ' + catID);
Thanks,
Brad