From: Daniel Arndt Date: Thu, 14 Sep 2017 13:36:17 +0000 (+0200) Subject: Replace single character strings X-Git-Tag: v9.0.0-rc1~1075^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5083%2Fhead;p=dealii.git Replace single character strings --- diff --git a/source/base/job_identifier.cc b/source/base/job_identifier.cc index 13df1dd755..38abaca935 100644 --- a/source/base/job_identifier.cc +++ b/source/base/job_identifier.cc @@ -54,9 +54,9 @@ std::string JobIdentifier::base_name(const char *filename) { std::string name(filename); - std::string::size_type pos = name.find("."); + std::string::size_type pos = name.find('.'); name.erase(pos, name.size()); - pos = name.rfind("/"); + pos = name.rfind('/'); if (pos < name.size()) name.erase(0,pos); return name; diff --git a/source/base/parameter_handler.cc b/source/base/parameter_handler.cc index 55c45e49ab..13dbeb6e98 100644 --- a/source/base/parameter_handler.cc +++ b/source/base/parameter_handler.cc @@ -1901,7 +1901,7 @@ ParameterHandler::scan_line (std::string line, // if there is a comment, delete it if (line.find('#') != std::string::npos) - line.erase (line.find("#"), std::string::npos); + line.erase (line.find('#'), std::string::npos); // replace \t by space: while (line.find('\t') != std::string::npos) @@ -1958,7 +1958,7 @@ ParameterHandler::scan_line (std::string line, // erase "set" statement line.erase (0, 4); - std::string::size_type pos = line.find("="); + std::string::size_type pos = line.find('='); AssertThrow (pos != std::string::npos, ExcCannotParseLine (current_line_n, input_filename, diff --git a/source/base/patterns.cc b/source/base/patterns.cc index 340d5723c2..0d9b68bc0e 100644 --- a/source/base/patterns.cc +++ b/source/base/patterns.cc @@ -955,7 +955,7 @@ namespace Patterns MultipleSelection::MultipleSelection (const std::string &seq) { - Assert (seq.find (",") == std::string::npos, ExcCommasNotAllowed(seq.find(","))); + Assert (seq.find (',') == std::string::npos, ExcCommasNotAllowed(seq.find(','))); sequence = seq; while (sequence.find(" |") != std::string::npos) @@ -977,10 +977,10 @@ namespace Patterns std::string name; name = tmp; - if (name.find(",") != std::string::npos) + if (name.find(',') != std::string::npos) { - name.erase (name.find(","), std::string::npos); - tmp.erase (0, tmp.find(",")+1); + name.erase (name.find(','), std::string::npos); + tmp.erase (0, tmp.find(',')+1); } else tmp = ""; diff --git a/source/base/timer.cc b/source/base/timer.cc index fe1a58ac94..15099ee4b0 100644 --- a/source/base/timer.cc +++ b/source/base/timer.cc @@ -546,7 +546,7 @@ TimerOutput::print_summary () const // resize the array so that it is always // of the same size - unsigned int pos_non_space = name_out.find_first_not_of (" "); + unsigned int pos_non_space = name_out.find_first_not_of (' '); name_out.erase(0, pos_non_space); name_out.resize (32, ' '); out_stream << std::endl; @@ -617,7 +617,7 @@ TimerOutput::print_summary () const // resize the array so that it is always // of the same size - unsigned int pos_non_space = name_out.find_first_not_of (" "); + unsigned int pos_non_space = name_out.find_first_not_of (' '); name_out.erase(0, pos_non_space); name_out.resize (32, ' '); out_stream << std::endl; diff --git a/source/base/utilities.cc b/source/base/utilities.cc index 9ca6a6e48d..983e1519a8 100644 --- a/source/base/utilities.cc +++ b/source/base/utilities.cc @@ -348,7 +348,7 @@ namespace Utilities while ((text.length() != 0) && (text[0] == delimiter)) text.erase(0, 1); - std::size_t pos_newline = text.find_first_of("\n", 0); + std::size_t pos_newline = text.find_first_of('\n', 0); if (pos_newline != std::string::npos && pos_newline <= width) { std::string line (text, 0, pos_newline); diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index fb94862a0e..4ab71c303f 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -2142,7 +2142,7 @@ void GridIn::parse_tecplot_header(std::string &header, // now remove whitespace in front of and // after '=' - std::string::size_type pos=header.find("="); + std::string::size_type pos=header.find('='); while (pos!=static_cast(std::string::npos)) if (header[pos+1]==' ') @@ -2153,7 +2153,7 @@ void GridIn::parse_tecplot_header(std::string &header, --pos; } else - pos=header.find("=",++pos); + pos=header.find('=',++pos); // split the string into individual entries std::vector entries=Utilities::break_text_into_lines(header,1,' ');