diff --git a/src/include/lffiles.h b/src/include/lffiles.h index bd3da435e..4e11af404 100755 --- a/src/include/lffiles.h +++ b/src/include/lffiles.h @@ -193,6 +193,10 @@ #define LF_TRASFATT 173 #define LF_IVALIQ 174 #define LF_CFPRI 175 +#define LF_FPCUST 176 +#define LF_FPCCAUS 177 +#define LF_FPCART 178 +#define LF_FPCADG 179 #define LF_EXTERNAL 1000 // Files with id >= are considered to be externals diff --git a/src/include/strings.cpp b/src/include/strings.cpp index e2599d9bf..e9bfa50cc 100755 --- a/src/include/strings.cpp +++ b/src/include/strings.cpp @@ -411,6 +411,21 @@ int TString::replace(char find_char, char replace_char) return n; } +int TString::replace(const char* find_string, const char* replace_string) +{ + int n = 0; + const int old_str_lenght = strlen(find_string); + const int new_str_lenght = strlen(replace_string); + for(int pos = find(find_string); pos >= 0; pos = find(find_string, pos + new_str_lenght)) + { + static TString app; app.cut(0); + app << this->left(pos) << replace_string << this->mid(pos + old_str_lenght); + *this = app; + n++; + } + return n; +} + // Certified 99% // @doc EXTERNAL @@ -1013,14 +1028,14 @@ TString& TString::insert( strcpy_s(&_str[pos+l], _size-(pos+l)+1, spark); // Aggiungi spark } return *this; -} - -TString & TString::add_front(const char * s) -{ - const int l = strlen(s); - lpad(len() + l); - overwrite(s); - return *this; +} + +TString & TString::add_front(const char * s) +{ + const int l = strlen(s); + lpad(len() + l); + overwrite(s); + return *this; } // Certified 90% @@ -1941,6 +1956,20 @@ void TToken_string::destroy(int n) restart(); } +const char* TToken_string::remove(const int pos) +{ + // Prelevo l'informazione della stringa + TString& ret = get_tmp_string(); + ret << get(pos); + + // La distruggo nel TToken_string + destroy(pos); + + // Ritorno + return ret; +} + + TToken_string& TToken_string::pack() { const char sep = separator(); diff --git a/src/include/strings.h b/src/include/strings.h index c91b72d07..b1a8802f3 100755 --- a/src/include/strings.h +++ b/src/include/strings.h @@ -113,6 +113,12 @@ public: int find(const char* s, int from = 0) const; // @cmember Sostituisce le occorrenze di
col carattere
int replace(char find_char, char replace_char); + // @cmember Sostituisce le occorrenze di
col carattere
+ int replace(const char * find_string, const char* replace_string);
+ // @cmember Ritorna se è contenuta almeno un'occorrenza del carattere c nell'oggetto TString
+ bool contains(const char c, const int from = 0) const { return find(c, from) >= 0; }
+ // @cmember Ritorna se è contenuta almeno un'occorrenza della stringa s nell'oggetto TString
+ bool contains(const char* s, const int from = 0) const { return find(s, from) >= 0; }
// @cmember Ritorna l'oggetto TString composto dai count caratteri da sinistra
const TString& left(int count) const;
@@ -648,6 +654,8 @@ public:
void insert_at(const char* s, int n);
// @cmember Toglie la stringa di posizione pos
void destroy(int pos);
+ // @cmember Toglie la stringa di posizione pos e la ritorna
+ const char* remove(int pos);
// @cmember Ritorna il prossimo token
const char* get();
diff --git a/src/include/utility.h b/src/include/utility.h
index 947523a19..84aada0f7 100755
--- a/src/include/utility.h
+++ b/src/include/utility.h
@@ -13,11 +13,14 @@
#include