From e972d832155b0c3e91f26c287f7f23037e17f6de Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Fri, 21 Apr 2023 22:28:12 +0200 Subject: move StringUtils.H to ablastr (#3864) --- Source/Utils/Strings/StringUtils.cpp | 51 ------------------------------------ 1 file changed, 51 deletions(-) delete mode 100644 Source/Utils/Strings/StringUtils.cpp (limited to 'Source/Utils/Strings/StringUtils.cpp') 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 - -std::vector 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 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(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; -} -- cgit v1.2.3