On , Anton S. Maximenko (2:5020/535.29@fidonet) wrote:
> Use simply circle (such us _while_) and scan your string for a point. If
> you'll find point - change last three symbols, if not - add point, three
> symbols of extantion and /0 symb. at the and of string.
Anton...
Some obvious problems:
1. Periods can (and do) sometimes appear in directory names, so the search
algorithm *has* to start at the end and work backwards.
2. Even starting at the end, once you find a period, you must then find out
if there's a path delimiter ('/' or '\\') to the right of it which would
indicate an embedded directory name.
3. You can't make any assumptions about the length of the extension, which
may be 1, 2, 3, or *0* characters long. The greatest impact on the algo-
rithm is the case where the original file had no extension and therefore
your search for a period may have been in vain.
--- QM v1.00
---------------
* Origin: MicroFirm : Down to the C in chips (1:106/2000.6)
|