45#include "tkn_config.h"
62 tkstring(
const unsigned char *_c) : std::string(reinterpret_cast< const char* >(_c)) {;}
63 tkstring(
const std::string &_s) : std::string(_s.data()) {;}
65 tkstring(
double _value,
double _error);
89 int64_t
atoll()
const {
return std::atoll(data());}
152 static const char*
form(
const char * _format, ...);
157 std::istream &
read_line(std::istream &_strm,
bool _skip_white =
true);
159 bool match(
const char *_pattern)
const;
164 if(length()==0)
return true;
180{
tkstring tmp = std::string::substr(__pos,__n);
return tmp;}
183{
return equal_to(_pat.data(),_cmp); }
186{
return index(_s, 0, _cmp) == 0; }
189{
return index(_pat.data(), 0, _cmp) == 0; }
195{
return index(_pat.data(), 0, _cmp) != npos; }
198{
return index(_s, 0, _cmp) != npos; }
201{
return index(_pat.data(), _pos, _cmp); }
204{
return replace_all(_s1.data(), _s1.length(), _s2.data(), _s2.length()) ; }
207{
return replace_all(_s1.data(), _s1.length(), _s2, _s2 ? strlen(_s2) : 0); }
210{
return replace_all(_s1, _s1 ? strlen(_s1) : 0, _s2.data(), _s2.length()); }
213{
return replace_all(_s1, _s1 ? strlen(_s1) : 0, _s2, _s2 ? strlen(_s2) : 0); }
222{
return match(_pat.data()); }
225{ insert(0,_st);
return *
this;}
228{ std::string::append(_st);
return *
this;}
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
tkstring extract_alpha()
Returns a tkstring composed only of the alphabetic letters of the original tkstring.
tkstring(const unsigned char *_c)
tkstring strip_all_extra_white_space() const
tkstring copy() const
Returns a copy of this string.
tkstring & to_lower()
Change all letters to lower case.
tkstring(const std::string &_s)
static const char * form(const char *_format,...)
bool is_float() const
Checks if string contains a floating point or integer number.
tkstring get_last_occurence(const char *_s1)
std::vector< tkstring > tokenize(const tkstring &_delim=" ") const
Create a vector of string separated by at least one delimiter.
static tkstring Form(const char *_format,...)
tkstring & remove_all(const tkstring &_s1)
tkstring substr(size_type __pos=0, size_type __n=npos) const
Inlines.
std::vector< tkstring > tokenize_from_string(const tkstring &_delim) const
Create a vector of string separated by a full string as delimiter.
bool match(const char *_pattern) const
bool is_alpha() const
Checks whether tkstring is only composed of alphabetic letters.
std::istream & read_line(std::istream &_strm, bool _skip_white=true)
tkstring::read_line
int atoi() const
Converts a string to integer value.
bool ends_with(const char *_s, ECaseCompare _cmp=kExact) const
static double get_absolute_error(tkstring val, tkstring error)
Get absolute uncertainty from value and error strings (1.27 4 -> 0.04), returns -1 in case of empty e...
bool equal_to(const char *_s, ECaseCompare _cmp=kExact) const
Returns true if the string and _s are identical.
size_t index(const char *_s, size_t _pos=0, ECaseCompare _cmp=kExact) const
Returns the index of the substring _s.
tkstring remove_alpha()
Returns a tkstring composed only of the non alphabetic letters of the original tkstring.
tkstring & remove_all_extra_white_space()
bool contains(const char *_pat, ECaseCompare _cmp=kExact) const
tkstring & prepend(const tkstring &_st)
int count_string(const tkstring &_st) const
bool begins_with(const char *_s, ECaseCompare _cmp=kExact) const
tkstring & append(const tkstring &_st)
tkstring & capitalize()
Change first letter of string from lower to upper case.
static double get_precision(tkstring _st)
Extract the precision for a given ENSDF data.
tkstring & replace_all(const tkstring &_s1, const tkstring &_s2)
bool is_digit() const
Checks if all characters in string are digits (0-9) or whitespaces.
int64_t atoll() const
Converts a string to long integer value.
tkstring remove_last_occurence(const char *_s1)
double atof() const
Converts a string to double value.
tkstring & to_upper()
Change all letters to upper case.
tklog & error(tklog &log)
tkstring & append(const tkstring &_st)
tkstring & preprend(const tkstring &_st)