Beispiel #1
0
double nl_convert_base_t::get_sp_val(const pstring &sin)
{
	std::size_t p = 0;
	while (p < sin.length() && (m_numberchars.find(sin.substr(p, 1)) != pstring::npos))
		++p;
	pstring val = plib::left(sin, p);
	pstring unit = sin.substr(p);
	double ret = get_sp_unit(unit) * plib::pstonum<double, true>(val);
	return ret;
}
Beispiel #2
0
double nl_convert_base_t::get_sp_val(const pstring &sin)
{
	std::size_t p = 0;
	while (p < sin.length() && (m_numberchars.find(sin.substr(p, 1)) != pstring::npos))
		++p;
	pstring val = sin.left(p);
	pstring unit = sin.substr(p);
	double ret = get_sp_unit(unit) * val.as_double();
	return ret;
}
Beispiel #3
0
double nl_convert_base_t::get_sp_val(const pstring &sin)
{
	int p = sin.len() - 1;
	while (p>=0 && (sin.substr(p,1) < "0" || sin.substr(p,1) > "9"))
		p--;
	pstring val = sin.substr(0,p + 1);
	pstring unit = sin.substr(p + 1);

	double ret = get_sp_unit(unit) * val.as_double();
	return ret;
}