TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ANTON S. MAXIMENKO
from: BOB STOUT
date: 1997-06-14 18:17:00
subject: String manipulation

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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.