comparison scripts/strings/ostrsplit.m @ 20038:9fc020886ae9

maint: Clean up m-files to follow Octave coding conventions. Try to trim long lines to < 80 chars. Use '##' for single line comments. Use '(...)' around tests for if/elseif/switch/while. Abut cell indexing operator '{' next to variable. Abut array indexing operator '(' next to variable. Use space between negation operator '!' and following expression. Use two newlines between endfunction and start of %!test or %!demo code. Remove unnecessary parens grouping between short-circuit operators. Remove stray extra spaces (typos) between variables and assignment operators. Remove stray extra spaces from ends of lines.
author Rik <rik@octave.org>
date Mon, 23 Feb 2015 14:54:39 -0800
parents 4197fc428c7d
children df437a52bcaf
comparison
equal deleted inserted replaced
20037:a1acca0c2216 20038:9fc020886ae9
106 %!assert (ostrsplit ("road to--hell", " -", true), {"road", "to", "hell"}) 106 %!assert (ostrsplit ("road to--hell", " -", true), {"road", "to", "hell"})
107 %!assert (ostrsplit (["a,bc";",de"], ","), {"a", "bc", char(ones(1,0)), "de "}) 107 %!assert (ostrsplit (["a,bc";",de"], ","), {"a", "bc", char(ones(1,0)), "de "})
108 %!assert (ostrsplit (["a,bc";",de"], ",", true), {"a", "bc", "de "}) 108 %!assert (ostrsplit (["a,bc";",de"], ",", true), {"a", "bc", "de "})
109 %!assert (ostrsplit (["a,bc";",de"], ", ", true), {"a", "bc", "de"}) 109 %!assert (ostrsplit (["a,bc";",de"], ", ", true), {"a", "bc", "de"})
110 110
111 %% Test input validation 111 ## Test input validation
112 %!error ostrsplit () 112 %!error ostrsplit ()
113 %!error ostrsplit ("abc") 113 %!error ostrsplit ("abc")
114 %!error ostrsplit ("abc", "b", true, 4) 114 %!error ostrsplit ("abc", "b", true, 4)
115 %!error <S and SEP must be string values> ostrsplit (123, "b") 115 %!error <S and SEP must be string values> ostrsplit (123, "b")
116 %!error <S and SEP must be string values> ostrsplit ("abc", 1) 116 %!error <S and SEP must be string values> ostrsplit ("abc", 1)