Logo Search packages:      
Sourcecode: pan version File versions

void Numbers::mark_str ( const StringView str,
bool  add = true 

Mark numbers from a text string in to_str() and from_str() fromat.

numbers ascii-formatted string of numbers to mark.
add true if we're adding the numbers, false if removing

Definition at line 193 of file numbers.cc.

References pan::StringView::empty(), mark_range(), pan::StringView::pop_token(), pan::StringView::str, and pan::StringView::trim().

   StringView phigh, p(str);

   while (p.pop_token (phigh, ','))
      StringView plow;
      phigh.pop_token (plow, '-');
      plow.trim ();
      phigh.trim ();
      const unsigned long low (plow.empty() ? 0 : strtoul (plow.str, NULL, 10));
      const unsigned long high (phigh.empty() ? low : strtoul (phigh.str, NULL, 10));
      mark_range (low, high, add);

Generated by  Doxygen 1.6.0   Back to index