[fpc-pascal]feature request: enhanced "pos"
dle3ab at angelbase.com
Fri Mar 5 23:07:12 CET 2004
Dunno if this is the right place to post such a message, but here goes...
I would love to see a "pos" function that takes an additional parameter, being the position in the string where it should START scanning. e.g.:
my_str = 'Hello, everybody... Hello, world!';
x := pos ('Hello', my_str, 6);
So it starts scanning at position 6 (after the first Hello) and finds the second Hello at position 21; returns 21. (not 21-6)
Passing it a starting position 2 (instead of 6) would also skip the first Hello, and return the same 21.
(( Of course, passing it a starting position greater than the length(str) - length(target) should return 0; also it should return 0 if the target is not found between startpos and the end of the string. ))
This would save so much processing time spent doing delete and copy!
More information about the fpc-pascal