comparison scripts/io/strread.m @ 18146:f8b7e8483b88 gui-release

avoid possible num-to-str warnings from strread.m * strread.m: Use "\n" instead of 10 and " " instead of 32 in comparisions with character strings.
author John W. Eaton <jwe@octave.org>
date Tue, 17 Dec 2013 15:02:35 -0600
parents d63878346099
children 7bbe3658c5ef 589354cf668f
comparison
equal deleted inserted replaced
18138:7721e78b1337 18146:f8b7e8483b88
394 pad_out = 0; 394 pad_out = 0;
395 ## Trim whitespace if needed 395 ## Trim whitespace if needed
396 if (! isempty (white_spaces)) 396 if (! isempty (white_spaces))
397 ## Check if trailing "\n" might signal padding output arrays to equal size 397 ## Check if trailing "\n" might signal padding output arrays to equal size
398 ## before it is trimmed away below 398 ## before it is trimmed away below
399 if ((str(end) == 10) && (nargout > 1)) 399 if (str(end) == "\n" && nargout > 1)
400 pad_out = 1; 400 pad_out = 1;
401 endif 401 endif
402 ## Condense all repeated whitespace into one single space 402 ## Condense all repeated whitespace into one single space
403 ## FIXME: this will also fold repeated whitespace in a char field 403 ## FIXME: this will also fold repeated whitespace in a char field
404 rxp_wsp = sprintf ("[%s]+", white_spaces); 404 rxp_wsp = sprintf ("[%s]+", white_spaces);
405 str = regexprep (str, rxp_wsp, ' '); 405 str = regexprep (str, rxp_wsp, ' ');
406 ## Remove possible leading space at string 406 ## Remove possible leading space at string
407 if (str(1) == 32) 407 if (str(1) == " ")
408 str = str(2:end); 408 str = str(2:end);
409 endif 409 endif
410 ## Check for single delimiter followed/preceded by whitespace 410 ## Check for single delimiter followed/preceded by whitespace
411 if (! isempty (delimiter_str)) 411 if (! isempty (delimiter_str))
412 dlmstr = setdiff (delimiter_str, " "); 412 dlmstr = setdiff (delimiter_str, " ");