comparison src/Cell.cc @ 5805:5bfb24f90bdd

[project @ 2006-05-10 21:15:37 by jwe]
author jwe
date Wed, 10 May 2006 21:15:37 +0000
parents dfa2da0563e5
children 67bf9b4f2ae2
comparison
equal deleted inserted replaced
5804:296cefb48d7e 5805:5bfb24f90bdd
29 29
30 #include "Cell.h" 30 #include "Cell.h"
31 #include "error.h" 31 #include "error.h"
32 #include "gripes.h" 32 #include "gripes.h"
33 33
34 Cell::Cell (const string_vector& sv) 34 Cell::Cell (const string_vector& sv, bool trim)
35 : ArrayN<octave_value> () 35 : ArrayN<octave_value> ()
36 { 36 {
37 octave_idx_type n = sv.length (); 37 octave_idx_type n = sv.length ();
38 38
39 if (n > 0) 39 if (n > 0)
40 { 40 {
41 resize (dim_vector (n, 1)); 41 resize (dim_vector (n, 1));
42 42
43 for (octave_idx_type i = 0; i < n; i++) 43 for (octave_idx_type i = 0; i < n; i++)
44 elem(i,0) = sv[i]; 44 {
45 std::string s = sv[i];
46
47 if (trim)
48 {
49 size_t n = s.find_last_not_of (' ');
50
51 s = (n == NPOS) ? "" : s.substr (0, n+1);
52 }
53
54 elem(i,0) = s;
55 }
45 } 56 }
46 } 57 }
47 58
48 Cell 59 Cell
49 Cell::index (const octave_value_list& idx_arg, bool resize_ok) const 60 Cell::index (const octave_value_list& idx_arg, bool resize_ok) const