alphabetical order sequence after specific text

alphabetical order sequence after specific text

49
Basic UserBasic User
49

    Mar 22, 2016#1

    Hi,

    how to alphabetical order sequence after specific text?

    If found

    Code: Select all

    "sec@@"
    "sec@@"
    "sec@@"
    "sec@@"
    ........
    "sec@@"
    "sec@@"
    "sec@@"
    "sec@@"
    replace with

    Code: Select all

    "secA"
    "secB"
    "secC"
    "secD"
    ........
    "secZ"
    "secAA"
    "secBB"
    "secCC"

    6,603547
    Grand MasterGrand Master
    6,603547

      Mar 23, 2016#2

      The script code is so easy for this task that I save time and don't comment it.

      Code: Select all

      if (UltraEdit.document.length > 0)
      {
         UltraEdit.insertMode();
         UltraEdit.columnModeOff();
         UltraEdit.activeDocument.top();
      
         UltraEdit.perlReOn();
         UltraEdit.activeDocument.findReplace.mode=0;
         UltraEdit.activeDocument.findReplace.matchCase=true;
         UltraEdit.activeDocument.findReplace.matchWord=false;
         UltraEdit.activeDocument.findReplace.regExp=true;
         UltraEdit.activeDocument.findReplace.searchDown=true;
         if (typeof(UltraEdit.activeDocument.findReplace.searchInColumn) == "boolean")
         {
            UltraEdit.activeDocument.findReplace.searchInColumn=false;
         }
      
         var asCharacters = ['A','B','C','D','E','F','G','H','I','J','K','L','M',
                             'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
         var nCharCount=1;
         var nCharacter=0;
      
         while(UltraEdit.activeDocument.findReplace.find("(?<=sec)@+"))
         {
            var sIdentifier="";
            for (var nCount=0; nCount < nCharCount; nCount++)
            {
               sIdentifier+=asCharacters[nCharacter];
            }
            UltraEdit.activeDocument.write(sIdentifier);
            if (++nCharacter >= asCharacters.length)
            {
               nCharacter=0;
               nCharCount++;
            }
         }
      }
      
      The character array can be modified to whatever you want.
      Best regards from an UC/UE/UES for Windows user from Austria

      49
      Basic UserBasic User
      49

        Mar 24, 2016#3

        Thanks Mofi. :P