SETSUBSTR Find number of substrings in string |
Top Previous Next |
This script command searches [ string ] for occurences of [ substr ] and saves the number of occurences found in [ variable ].
Consider the following examples.
;; find the number of file name segments SET filename = "data.temporary.sbc.xml" ;; find how many "." occur SETSUBSTR dots = filename "." ;; dots will be equal to 3 (segments equals dots + 1)
;; determine if file name has an extension SETSUBSTR dots = filename "." IFNUM= dots 0 goto no_extension
Related Command(s): SET, SETEXTRACT, SETRIGHT, SETLEFT, SETLEN, SETMID
|