Loading ...
Sorry, an error occurred while loading the content.
 

Re: [NTO] Address the words before the 1st semicolon

Expand Messages
  • Don - htmlfixit.com
    non-regular expression clip that does this: ;by don at htmlfixit.com ;Input: ;First Last; Words2; Words3; Words4; ;First Middle Last; Words2; Words3; ;Output:
    Message 1 of 2 , Dec 21, 2004
      non-regular expression clip that does this:

      ;by don at htmlfixit.com
      ;Input:
      ;First Last; Words2; Words3; Words4;
      ;First Middle Last; Words2; Words3;

      ;Output:
      ;Last First; Words2; Words3; Words4;
      ;Last First Middle; Words2; Words3;

      ;start of clip
      ^!Jump Doc_Start

      :Loop
      ^!ClearVariables
      ^!Select EOL
      ;split line on ;
      ^!SetListDelimiter ";"
      ; set array = to selection
      ^!SetArray %first_split%=^$GetSelection$
      ;split first data element (First [Middle] Last)
      ^!SetListDelimiter " "
      ; set array = to selection
      ^!SetArray %second_split%=^%first_split1%
      ;move Last to beginning of line
      ^!Set %first_split1%="^$StrReplace("
      ^%second_split^%second_split0%%";"";"^%first_split1%";False;False)$"
      ;the rebuild the first array element
      ^!Set %first_split1%="^%second_split^%second_split0%% ^%first_split1%"


      ;create loop to build complete line of output
      ^!Set %outCount%="1"
      :setOutput
      ^!Set %output%="^%output%^%first_split^%outCount%%;"
      ^!Inc %outCount%
      ^!If ^%outCount% < ^%first_split0% setOutput
      ;put output on clipboard and paste it over original
      ^!SetClipboard ^%output%
      ^!Paste
      ;jump to next line
      ^!Jump +1
      ;repeat til done
      ^!If ^$GetRow$ = ^$GetLinecount$ Next ELSE Loop
      ;if done say so
      ^!Info Done
    Your message has been successfully submitted and would be delivered to recipients shortly.