Txt-Unic name

From Vectorlab

Revision as of 09:44, 14 May 2009 by Orso (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search


Function to create a create an unique name within the chosen environment: layers or not. Load the routines T_NameWillCollide and T_SplitNameFromNum before this. By Orso B. Schmid


{ Orso *********************************************** }
{ creates a unique name in NNA style "xxxxx-1" }
FUNCTION T_UnicName(inLayers: BOOLEAN; startName: STRING): STRING;
    VAR
        i, nr : INTEGER;
        proposedName, tempName : STRING;
        
    BEGIN
        proposedName := startName;
        
        WHILE T_NameWillCollide(inLayers, proposedName) DO BEGIN
            nr := T_SplitNameFromNum(proposedName); { this extracts the number from the name } 
            proposedName := Concat(proposedName, -(nr + 1));
        END;
        
        T_UnicName := proposedName;
    END;
Personal tools