Aggiuntol il parametro fillchar al costruttore TString(int size)

TString(int size,char fillchar='\0') che permette di creare stringhe
di size caratteri fillchar


git-svn-id: svn://10.65.10.50/trunk@4326 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
augusto 1997-05-08 14:00:53 +00:00
parent 0fcfd4fce7
commit 7affcbf253
2 changed files with 9 additions and 3 deletions

View File

@ -125,8 +125,14 @@ TString::TString(const char* s) : _str(NULL), _size(0)
TString::TString(const TString& s) : _str(NULL), _size(0)
{ set(s); }
TString::TString(int size) : _str(NULL), _size(0)
{ resize(size, FALSE); }
TString::TString(int size, char c) : _str(NULL), _size(0)
{
resize(size, FALSE);
*(_str+size--)='\0';
for (;c && size>=0; size--)
*(_str+size)=c;
}
TString::TString() : _str(NULL), _size(0)
{ resize(7, FALSE); }

View File

@ -46,7 +46,7 @@ public:
// @cmember Costruttore
TString();
// @cmember Costruttore di default per una stringa data
TString(int size);
TString(int size, char c='\0');
// @cmember Costruttore a partire da una stringa s
TString(const char* s);
// @cmember Costruttore da un oggetto TString s