Navigation

Operators and Keywords

Function List:

C++ API

strtrunc.m File Reference


Functions

endif if (ischar(s)) s_was_char
endif if (iscellstr(s)) for i
endfor else error ("strtrunc: s must be a character string or a cell array of strings")
endif if (s_was_char) s
endif endfunction!error
< Invalid call to strtrunc > 
strtrunc ()
!error< s must be a character
string or a cell array of
strings
strtrunc (1, 1)%!assert(strtrunc("abcdefg"
 !assert (strtrunc("abcdefg", 10),"abcdefg")
 !assert (strtrunc({"abcdef","fedcba"}, 3),{"abc","fed"})

Variables

function s
else s_was_char = false
!error< s must be a character
string or a cell array of
strings
abcd

Function Documentation

!assert ( strtrunc({"abcdef","fedcba"}, 3)   ) 

!assert ( strtrunc("abcdefg", 10)  ,
"abcdefg"   
)

endfor else error ( "strtrunc: s must be a character string or a cell array of strings  ) 

endif if ( s_was_char   ) 

endif if ( iscellstr(s)   ) 

endif if ( ischar(s)   ) 

!error<s must be a character string or a cell array of strings> strtrunc ( ,
 
)

endif endfunction !error<Invalid call to strtrunc> strtrunc (  ) 


Variable Documentation

!error<s must be a character string or a cell array of strings> abcd

s

Initial value:

 strtrunc (s, n)

  if (nargin != 2)
    print_usage ()

else s_was_char = false