Index: trunk/SRC/ToBeReviewed/STRING/strcnt.pro
===================================================================
--- trunk/SRC/ToBeReviewed/STRING/strcnt.pro	(revision 116)
+++ 	(revision )
@@ -1,112 +1,0 @@
-;
-;+
-; NAME:
-;       STRCNT
-; PURPOSE:
-;       Count number of occurrences of a substring in a string.
-; CATEGORY:
-;       text/strings
-; CALLING SEQUENCE:
-;       num = strcnt(strn, substring, [pos])
-; INPUTS:
-;       string    -- The string in which to count occurences.     in
-;       substring -- The substring to count occurrences of.       in
-;       pos       -- the position at which to begin the search.   [in]
-;                    If not supplied, start at beginning of
-;                    string.
-; KEYWORD PARAMETERS:
-;       /HELP     -- Print useful message and return.
-; OUTPUTS:
-;       num       -- Number of occurances of substring in string. out
-; COMMON BLOCKS:
-; SIDE EFFECTS:
-; NOTES:
-;       Overlapping occurances are not counted separately.  For
-;       example, counting occurances of 'bb' in 'blah bbb' returns one
-;       occurance. 
-; EXAMPLE:
-; MODIFICATION HISTORY:
-;       $Id$
-;       $Log: strcnt.pro,v $
-;       Revision 1.3  1996/06/14 20:00:27  mcraig
-;       Updated Copyright info.
-;
-;       Revision 1.2  1996/05/09 00:22:17  mcraig
-;       Added fast processing using BYTE arrays if we are counting occurences of
-;       a single character.  Added error handling.
-;
-;       Revision 1.1  1996/01/31 18:47:37  mcraig
-;       Initial revision
-;
-; RELEASE:
-;       $Name: Rel_1_2 $
-;
-; COPYRIGHT:
-;  Copyright (C) 1996 The Regents of the University of California, All
-;  Rights Reserved.  Written by Matthew W. Craig.
-;  See the file COPYRIGHT for restrictions on distrubting this code.
-;  This code comes with absolutely NO warranty; see DISCLAIMER for details.
-;-
-FUNCTION strcnt, strn, substrn, startpos, $
-                 HELP=Help
-;
-  compile_opt idl2, strictarrsubs
-;
-
-; Return to caller if error.
-    On_error, 2
-
-; Help user, if needed.
-    IF (n_params() LT 2) OR keyword_set(Help) THEN BEGIN
-        offset = '   '
-        print, offset+'Count number of occurrences of a substring in a string.'
-        print, offset+'num = strcnt(strn, substring, [pos])'
-        print, offset+'Inputs:'
-        print,offset+offset+'string    -- The string in which to count occurences.     in'
-        print,offset+offset+'substring -- The substring to count occurrences of.       in'
-        print,offset+offset+'pos       -- the position at which to begin the search.   [in]'
-        print,offset+offset+'             If not supplied, start at beginning of'
-        print,offset+offset+'             string.'
-        print, offset+'Keywords:'
-        print,offset+offset+'/HELP     -- Print useful message and return.'
-        print, offset+'Outputs:'
-        print,offset+offset+'num       -- Number of occurances of substring in string. out'
-        return, -1
-    ENDIF 
-
-    IF n_params() EQ 2 THEN startpos = 0
-
-;  return if we weren't really given a substring to search for. . .
-    IF strlen(substrn) EQ 0 THEN BEGIN 
-        print, "Error: Can't count occurances of null string."
-        return, -1
-    ENDIF 
-
-; . . .or if we were told to start at the end of the string.
-    tmpstrn = strmid(strn, startpos, strlen(strn))
-    IF strlen(tmpstrn) EQ 0 THEN return, 0
-
-; If looking for occurences of single character, process using BYTE
-; array.
-    IF strlen(substrn) EQ 1 THEN BEGIN
-        tmpstrn = byte(TmpStrn)
-        count = n_elements(where(TmpStrn EQ (byte(substrn))[0])) 
-    ENDIF ELSE BEGIN 
-        count = 0L
-        pos = rstrpos(tmpstrn, substrn)
-        WHILE pos GE 0 DO BEGIN
-            count = count + 1
-            pos = rstrpos(tmpstrn, substrn, pos)
-        ENDWHILE
-    ENDELSE 
-
-    return, count
-END 
-
-
-
-
-
-
-
-
Index: trunk/SRC/ToBeReviewed/STRING/strtrans.pro
===================================================================
--- trunk/SRC/ToBeReviewed/STRING/strtrans.pro	(revision 116)
+++ 	(revision )
@@ -1,131 +1,0 @@
-;
-;+
-; NAME:
-;       STRTRANS
-; PURPOSE:
-;       Translate all occurences of one substring to another.
-; CATEGORY:
-;       text/strings
-; CALLING SEQUENCE:
-;       new = strtrans(oldstr,from,to,ned)
-; INPUTS:
-;       oldstr -- string on which to operate.              in
-;                 May be an array.
-;       from   -- substrings to be translated. May be      in
-;                 an array.
-;       to     -- what strings in from should be           in
-;                 translated to. May be an array.
-; KEYWORD PARAMETERS:
-;       /HELP  -- Set this to print useful message and 
-;                 exit.
-; OUTPUTS:
-;       new    -- Translated string. Array if oldstr is    out          
-;                 an array.
-;       ned    -- number of substitutions performed in     out
-;                 oldstr.  Array if oldstr is an array.
-; COMMON BLOCKS:
-; SIDE EFFECTS:
-; NOTES:
-;       - Any of old, from, and to can be arrays.  
-;       - from and to must have the same number of elements.
-; EXAMPLE:
-;       inp='Many*bad!chars+in_here'
-;       from=['*','!','+','_']
-;       to  =[' ',' ',' ',' ']
-;       out = strtrans(inp,from,to,ned)
-;       Will produce out='Many bad chars in here', and set ned to 4.
-; MODIFICATION HISTORY:
-;       $Id$
-;       $Log: strtrans.pro,v $
-;       Revision 1.3  1996/06/14 20:00:27  mcraig
-;       Updated Copyright info.
-;
-;       Revision 1.2  1996/05/09 00:22:17  mcraig
-;       Sped up significantly by using str_sep to handle the translation.  No longer
-;       relies on routines fromother user libraries.
-;
-;       Revision 1.1  1996/01/31 18:47:37  mcraig
-;       Initial revision
-;
-; RELEASE:
-;       $Name: Rel_1_2 $
-;
-; COPYRIGHT:
-;  Copyright (C) 1996 The Regents of the University of California, All
-;  Rights Reserved.  Written by Matthew W. Craig.
-;  See the file COPYRIGHT for restrictions on distrubting this code.
-;  This code comes with absolutely NO warranty; see DISCLAIMER for details.
-;-
-;
-FUNCTION strtrans, InputString, from, to, ned,  $
-                   HELP=Help
-;
-  compile_opt idl2, strictarrsubs
-;
-
-; Bomb out to caller if error.
-    On_error, 2
-
-; Offer help if we don't have at least InputString, from, and to, or
-; if the user asks for it.
-    IF (n_params() LT 3) OR keyword_set(help) THEN BEGIN
-        offset = '   '
-        print, offset+'Translate all occurences of one substring to another.'
-        print, offset+'new = strtrans(oldstr,from,to,ned)'
-        print, offset+'Inputs:'
-        print, offset+offset+'oldstr -- string on which to operate.              in'
-        print, offset+offset+'          May be an array.'
-        print, offset+offset+'from   -- substrings to be translated. May be      in'
-        print, offset+offset+'          an array.'
-        print, offset+offset+'to     -- what strings in from should be           in'
-        print, offset+offset+'          translated to. May be an array.'
-        print, offset+'Outputs:'
-        print, offset+offset+'new    -- Translated string. Array if oldstr is    out'
-        print, offset+offset+'          an array.'
-        print, offset+offset+'ned    -- number of substitutions performed in     out'
-        print, offset+offset+'          oldstr.  Array if oldstr is an array.'
-        print, offset+'Notes:'
-        print, offset+offset+'- Any of old, from, and to can be arrays. ' 
-        print, offset+offset+'- from and to must have the same number of elements.'
-        return, -1
-    ENDIF 
-    
-    strn = InputString
-
-;  Check that From/To have same number of elements.  RETURN if they don't.
-    NFrom = n_elements(from)
-    NTo = n_elements(to)
-    IF (NFrom EQ 0) OR (NTo EQ 0) THEN return, strn
-    IF NFrom NE NTo THEN BEGIN
-        print,'Error: Number of elements in from/to unequal'
-        return,-1
-    ENDIF
-
-;  Make sure there are no null strings in From.  RETURN if there are.   
-    FromLen = strlen(From)
-    IF (total(FromLen EQ 0) GT 0) THEN BEGIN
-        print, 'Error: elements of From must have nonzero length.'
-        return, -1
-    ENDIF 
-
-    NStrings = n_elements(strn)
-    ned = lonarr(NStrings)
-    tmpned = 0L
-
-; Say strn='a#b#c', from='#' and to='@'.  Then the approach here is to
-; first split strn at all occurances of '#', then recombine the pieces
-; with '@' inserted instead.  Do this for all elements of strn, and
-; all elements of from.
-    FOR i = 0L, NStrings-1 DO BEGIN
-        ned(i) = 0L
-        FOR j=0L, NFrom-1 DO BEGIN
-            SepStr = str_sep(strn(i), from(j))
-            NSubs = n_elements(SepStr) - 1
-            strn(i) = SepStr(0)
-            FOR k=1L, NSubs DO strn(i) = strn(i) + To(j) + SepStr(k)
-            ned(i) =  ned(i) + NSubs
-        ENDFOR 
-    ENDFOR
-
-    return, strn
-END 
