]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fixes bug in Pattern::Selection
authorsairajat <rajat.arora9464@gmail.com>
Mon, 6 Feb 2017 17:09:35 +0000 (12:09 -0500)
committersairajat <rajat.arora9464@gmail.com>
Mon, 6 Feb 2017 17:09:35 +0000 (12:09 -0500)
source/base/parameter_handler.cc

index ccf56d3c9dabdc4a3eadc20ce9bf95fd29959448..128e2410b386c8a6cfdaf60aadd3f1f649ee6db1 100644 (file)
@@ -467,6 +467,10 @@ namespace Patterns
   bool Selection::match (const std::string &test_string) const
   {
     std::string tmp(sequence);
+    // remove whitespace at beginning
+    while ((tmp.length() != 0) && (std::isspace (tmp[0])))
+      tmp.erase (0,1);
+
     // check the different possibilities
     while (tmp.find('|') != std::string::npos)
       {
@@ -475,6 +479,11 @@ namespace Patterns
 
         tmp.erase (0, tmp.find('|')+1);
       };
+
+    //remove whitespace at the end
+    while ((tmp.length() != 0) && (std::isspace (tmp[*(tmp.end()-1)])))
+      tmp.erase (tmp.end()-1);
+
     // check last choice, not finished by |
     if (test_string == tmp)
       return true;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.