;+ ;NAME: ;thm_check_valid_name ;PURPOSE: ;checks a string or array input against another array and 'all' to ;find matches. ;CALLING SEQUENCE: ; ok_names = thm_check_valid_name(names, valid_names) ;INPUT: ; names = a string array of possible names for data types, stations, ; etc... ; valid_names = those names that will be valid ;OUTPUT: ; ok_names = the valid data names, if there are none, then the null ; string is returned ;KEYWORDS: ; include_all = if set, include 'all' in the possible datanames ;HISTORY: ; 22-jan-2007, jmm, jimm@ssl.berkeley.edu ; ; $LastChangedBy: kenb-mac $ ; $LastChangedDate: 2007-01-26 15:52:34 -0800 (Fri, 26 Jan 2007) $ ; $LastChangedRevision: 241 $ ; $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/trunk/idl/themis/common/thm_check_valid_name.pro $ ;- Function thm_check_valid_name, names_in, valid_names, include_all = include_all otp = '' If(is_string(names_in[0]) Eq 0 Or $ is_string(valid_names[0]) Eq 0) Then Return, otp If(keyword_set(include_all)) Then vn = ['all', valid_names] $ Else vn = valid_names otp = strfilter(vn, names_in, delimiter = ' ', /string) If(not keyword_set(otp)) Then Begin message, /info, 'Input must be one or more of the following strings:' print, vn Return, '' Endif If(keyword_set(include_all)) Then Begin all = where(otp Eq 'all') If(all[0] ne -1) Then otp = valid_names Endif Return, otp End