suplibxx  1.3.9
iscomment.cc
1 // --8<--8<--8<--8<--
2 //
3 // Copyright (C) 2006 Smithsonian Astrophysical Observatory
4 //
5 // This file is part of suplibxx
6 //
7 // suplibxx is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
11 //
12 // suplibxx is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the
19 // Free Software Foundation, Inc.
20 // 51 Franklin Street, Fifth Floor
21 // Boston, MA 02110-1301, USA
22 //
23 // -->8-->8-->8-->8--
24 
25 #include <iostream>
26 #include <string>
27 
28 using namespace std;
29 
30 #include "str.h"
31 
47 bool
49  const string& str,
50  const string& ignore,
51  const string& comment
52  )
53 {
54  size_t comment_pos = str.find_first_of( comment );
55  if ( str.npos != comment_pos && comment_pos == str.find_first_not_of( ignore ) )
56  return true;
57  else
58  return false;
59 }
bool iscomment(const string &str, const string &ignore=" \t", const string &comment="#")
determine if the string is a comment.
Definition: iscomment.cc:48