Subversion Repositories spk

Rev

Rev 104 | Rev 121 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 104 Rev 109
Line 59... Line 59...
59
}
59
}
60

60

61
void String::fromFloat(float f, int dp)
61
void String::fromFloat(float f, int dp)
62
{
62
{
63
	std::stringstream strstream;
63
	std::stringstream strstream;
-
 
64
	if ( dp != -1 ) {
64
	strstream.precision(dp);
65
		strstream.precision(dp);
65
	strstream << std::fixed << f;
66
		strstream << std::fixed << f;
-
 
67
	}
-
 
68
	else
-
 
69
		strstream << f;
66
	*this = strstream.str();
70
	*this = strstream.str();
67
}
71
}
68

72

69
void String::fromFloat(float f)
-
 
70
{
-
 
71
	std::stringstream strstream;
-
 
72
	strstream << f;
-
 
73
	*this = strstream.str();
-
 
74
}
-
 
75
void String::fromDouble(double f)
73
void String::fromDouble(double f)
76
{
74
{
77
	std::stringstream strstream;
75
	std::stringstream strstream;
78
	strstream << f;
76
	strstream << f;
79
	*this = strstream.str();
77
	*this = strstream.str();
80
}
78
}
81
79
82
const String &String::format(const char *sFormat, ...)
80
const String &String::format(const char *sFormat, ...)
83
{
81
{
84
	char buffer[1024];
82
	char buffer[1024];
85
	va_list args;
83
	va_list args;
86
	va_start (args, sFormat);
84
	va_start (args, sFormat);
Line 108... Line 106...
108
	return (*this);
106
	return (*this);
109
}
107
}
110
const String &String::arg(const String &s1, const String &s2, const String &s3, const String &s4)
108
const String &String::arg(const String &s1, const String &s2, const String &s3, const String &s4)
111
{
109
{
112
	(*this) = this->arg(s1, s2, s3).findReplace("%4", s4);
110
	(*this) = this->arg(s1, s2, s3).findReplace("%4", s4);
113
	return (*this);
111
	return (*this);
114
}
112
}
115
const String &String::arg(const String &s1, const String &s2, const String &s3, const String &s4, const String &s5)
113
const String &String::arg(const String &s1, const String &s2, const String &s3, const String &s4, const String &s5)
116
{
114
{
117
	(*this) = this->arg(s1, s2, s3, s4).findReplace("%5", s5);
115
	(*this) = this->arg(s1, s2, s3, s4).findReplace("%5", s5);
118
	return (*this);
116
	return (*this);
119
}
117
}
120
118
121

119

122
String String::Null()
120
String String::Null()
123
{
121
{
124
	return Utils::String();
122
	return Utils::String();
-
 
123
}
-
 
124

-
 
125
String String::FromFloat(float f, int dp)
-
 
126
{ 
-
 
127
	String str;
-
 
128
	str.fromFloat(f, dp); 
-
 
129
	return str;
125
}
130
}
126

131

127
String String::Format(const char *sFormat, ...)
132
String String::Format(const char *sFormat, ...)
128
{
133
{
129
	char buffer[1024];
134
	char buffer[1024];