Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) IsNewick

 

IsNewick is a Newick code snippets to determine if a std::string is a well-formed Newick.

 

///IsNewick returns true if a std::string is a valid Newick
///and false otherwise.
///From http://www.richelbilderbeek.nl/CppIsNewick.htm
bool IsNewick(const std::string& s)
{
  try
  {
    CheckNewick(s);
  }
  catch (...)
  {
    return false;
  }
  return true;
}

///IsNewick returns true if a std::vector<int> is a valid Newick
///and false otherwise.
///From http://www.richelbilderbeek.nl/CppIsNewick.htm
bool IsNewick(const std::vector<int>& v)
{
  try
  {
    CheckNewick(v);
  }
  catch (...)
  {
    return false;
  }
  return true;
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict