


check whether a given string is alphanumerical or underscore
FORMAT out = prt_checkAlphaNumUnder(s)
Inputs:
s - a string of arbitrary length to check
Output:
out - logical 1 if the all chars in the string are alphanumerical
logical 0 otherwise
Based on isalpha_num in the identification toolbox
__________________________________________________________________________
Copyright (C) 2011 PRoNTo

0001 function out=prt_checkAlphaNumUnder(s) 0002 % check whether a given string is alphanumerical or underscore 0003 % FORMAT out = prt_checkAlphaNumUnder(s) 0004 % Inputs: 0005 % s - a string of arbitrary length to check 0006 % Output: 0007 % out - logical 1 if the all chars in the string are alphanumerical 0008 % logical 0 otherwise 0009 % 0010 % Based on isalpha_num in the identification toolbox 0011 %__________________________________________________________________________ 0012 % Copyright (C) 2011 PRoNTo 0013 0014 %-------------------------------------------------------------------------- 0015 % Written by J.Richiardi 0016 % $Id$ 0017 0018 % sanity check 0019 if ~ischar(s) 0020 error('Input is not a string'); 0021 end 0022 0023 for i=1:length(s) 0024 out=~isempty(strfind('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_',upper(s(i)))); 0025 if out==false 0026 break; 0027 end 0028 end