Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Namespaces | Functions
string.hpp File Reference
#include "shambase/aliases_int.hpp"
#include "exception.hpp"
#include <fmt/base.h>
#include <fmt/core.h>
#include <fmt/format.h>
#include <fmt/printf.h>
#include <fmt/ranges.h>
#include <string_view>
#include <array>
#include <fstream>
#include <vector>
+ Include dependency graph for string.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  shambase
 namespace for basic c++ utilities
 

Functions

 shambase::__attribute__ ((always_inline)) auto vformat(std
 format a string using fmtlib style Cheat sheet : https://hackingcpp.com/cpp/libs/fmt.html
 
template<class It , typename... Tformat>
std::string shambase::format_array (const It &iter, u32 len, u32 column_count, fmt::format_string< Tformat... > fmt)
 Format an array of elements into a string.
 
std::string shambase::readable_sizeof (double size)
 given a sizeof value return a readble string Example : readable_sizeof(1024*1024*1024) -> "1.00 GB"
 
void shambase::write_string_to_file (std::string filename, std::string s)
 dump a string to a file
 
void shambase::replace_all (std::string &inout, std::string_view what, std::string_view with)
 replace all occurence of a search string with another
 
std::string shambase::increase_indent (std::string in, std::string delim="\n ")
 Increase indentation of a string.
 
std::string shambase::trunc_str (std::string s, u32 max_len)
 Truncate a string to a specified length, adding an ellipsis if necessary.
 
std::string shambase::trunc_str_start (std::string s, u32 max_len)
 Truncate a string to a specified length, adding an ellipsis at the start if necessary.
 
bool shambase::contain_substr (std::string str, std::string what)
 Check if a substring is present in a given string.
 
std::string shambase::shorten_string (std::string str, u32 len)
 Shortens a string by removing the last specified number of characters.
 
std::vector< std::string > shambase::split_str (std::string s, std::string delimiter)
 Splits a string into a vector of substrings according to a delimiter.
 

Detailed Description

Author
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)

Definition in file string.hpp.