;+ ; NAME: ; strbreak ; PURPOSE: ; Split string in pieces at white space ; CALLING SEQUENCE: FUNCTION strbreak, label, tokens=tokens ; COMMON: @compile_opt.pro ; PROCEDURE: ; Substrings enclosed by double quotes are left intact, ; i.e. are treated as a single piece without whitespace. ;- destroyvar, tokens p = 0 p_open = strpos( strmid(label,p), '"' ) WHILE p_open NE -1 DO BEGIN IF p_open GT 0 THEN BEGIN q = strmid(label,p,p_open) IF strlen( strcompress(q,/rem) ) GT 0 THEN boost, tokens, strtok( q,' ',/extract ) ENDIF p_close = strpos( strmid(label,p+p_open+1), '"' ) IF p_close EQ -1 THEN BEGIN message, /info, 'bad label: missing closing quote: "'+label+'"' destroyvar, tokens RETURN, 0 ENDIF IF p_close GT 0 THEN boost, tokens, strmid( label, p+p_open+1, p_close ) p += p_open+1+p_close+1 p_open = strpos( strmid(label,p), '"' ) ENDWHILE IF p LT strlen(label) THEN boost, tokens, strtok( strmid(label,p),' ',/extract ) RETURN, n_elements(tokens) & END