added String<T>::percentOf
This commit is contained in:
@@ -524,6 +524,7 @@ namespace hgl
|
|||||||
* @param str2 要查找的字符串
|
* @param str2 要查找的字符串
|
||||||
* @param size2 str2的长度
|
* @param size2 str2的长度
|
||||||
* @return str2在str1中所在位置的指针
|
* @return str2在str1中所在位置的指针
|
||||||
|
* @return nullptr 没有找到
|
||||||
*/
|
*/
|
||||||
template<typename T1,typename T2>
|
template<typename T1,typename T2>
|
||||||
T1 *stristr(T1 *str1,const uint size1,T2 *str2,const uint size2)
|
T1 *stristr(T1 *str1,const uint size1,T2 *str2,const uint size2)
|
||||||
@@ -568,7 +569,7 @@ namespace hgl
|
|||||||
++cp;
|
++cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -153,6 +153,12 @@ namespace hgl
|
|||||||
|
|
||||||
#undef BASE_STRING_FLOAT_CONSTRUCT
|
#undef BASE_STRING_FLOAT_CONSTRUCT
|
||||||
|
|
||||||
|
template<typename N1,typename N2>
|
||||||
|
static String<T> percentOf(const N1 numerator,const N2 denominator,const uint frac_num)
|
||||||
|
{
|
||||||
|
return String<T>::floatOf(double(numerator)/double(denominator)*100.0f,frac_num);
|
||||||
|
}
|
||||||
|
|
||||||
String(const int *value,int N)=delete;
|
String(const int *value,int N)=delete;
|
||||||
|
|
||||||
static String<T> numberOf(const int *value,int N)
|
static String<T> numberOf(const int *value,int N)
|
||||||
|
Reference in New Issue
Block a user