diff options
author | 2023-04-21 22:28:12 +0200 | |
---|---|---|
committer | 2023-04-21 13:28:12 -0700 | |
commit | e972d832155b0c3e91f26c287f7f23037e17f6de (patch) | |
tree | 25d034efaf9cc766bf55dd5702ae5bfc98abe237 /Source/Utils/Strings/StringUtils.cpp | |
parent | 7170d1b45c5092c060655ec216e4e56be74b3edb (diff) | |
download | WarpX-e972d832155b0c3e91f26c287f7f23037e17f6de.tar.gz WarpX-e972d832155b0c3e91f26c287f7f23037e17f6de.tar.zst WarpX-e972d832155b0c3e91f26c287f7f23037e17f6de.zip |
move StringUtils.H to ablastr (#3864)
Diffstat (limited to 'Source/Utils/Strings/StringUtils.cpp')
-rw-r--r-- | Source/Utils/Strings/StringUtils.cpp | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/Source/Utils/Strings/StringUtils.cpp b/Source/Utils/Strings/StringUtils.cpp deleted file mode 100644 index f095794c9..000000000 --- a/Source/Utils/Strings/StringUtils.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright 2022 Andrew Myers, Luca Fedeli, Maxence Thevenet - * Revathi Jambunathan - * - * This file is part of WarpX. - * - * License: BSD-3-Clause-LBNL - */ - -#include "StringUtils.H" - -#include <sstream> - -std::vector<std::string> automatic_text_wrap( - const std::string& text, const int max_line_length){ - - auto ss_text = std::stringstream{text}; - auto wrapped_text_lines = std::vector<std::string>{}; - - std::string line; - while(std::getline(ss_text, line,'\n')){ - - auto ss_line = std::stringstream{line}; - int counter = 0; - std::stringstream ss_line_out; - std::string word; - - while (ss_line >> word){ - const auto wlen = static_cast<int>(word.length()); - - if(counter == 0){ - ss_line_out << word; - counter += wlen; - } - else{ - if (counter + wlen < max_line_length){ - ss_line_out << " " << word; - counter += (wlen+1); - } - else{ - wrapped_text_lines.push_back(ss_line_out.str()); - ss_line_out = std::stringstream{word}; - counter = wlen; - } - } - } - - wrapped_text_lines.push_back(ss_line_out.str()); - } - - return wrapped_text_lines; -} |