function [text_found,dir_name,file_name]=gui_str_find(text_str,str2find,end_char,ii_sep);
%
%
% COPYRIGHT (c) 2008
% 
% Applied Research Laboratories, The University of Texas at Austin
% (ARL:UT)
% All rights reserved.
% 
% This material may be reproduced by or for the U.S. Government
% only. This notice must appear in all copies of this file and its
% derivatives. Further distribution outside the U.S. Government is
% prohibited without the explicit written authorization from the
% Director of the Environmental Sciences Laboratory, ARL:UT.
% 
% THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
% EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE
% IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
% PURPOSE, OR NONINFRINGEMENT.
% 
% IN NO EVENT WILL ARL:UT BE LIABLE FOR ANY DAMAGES WHATSOEVER ARISING
% OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN IF ARL:UT HAS
% BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
ii1=findstr(text_str,str2find); ii1=ii1+length(str2find);
if ischar(end_char),
    ii2=findstr(text_str(ii1:end),end_char); ii2=ii2(1)-1+ii1-1;
else
    ii2=ii1+end_char-1;
end
text_found=text_str(ii1:ii2); 
if ii_sep==1,
    slashes=unique([findstr(text_found,'\'),findstr(text_found,'/')]);
    dir_name=text_found(1:slashes(end)); file_name=text_found(slashes(end)+1:end);
elseif ii_sep==2,
    text_found=str2num(text_found);
end
