added: to misc:
void MaxSize(StringType & str, size_t max_size) if a string is larger than max_size then it is truncated to max_size characters git-svn-id: svn://ttmath.org/publicrep/winix/trunk@805 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
f381f24402
commit
9d2be5c50d
11
core/misc.h
11
core/misc.h
|
@ -2,7 +2,7 @@
|
|||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
||||
* Copyright (c) 2008-2012, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
@ -249,6 +249,15 @@ typename StringType::size_type i;
|
|||
}
|
||||
|
||||
|
||||
template<class StringType>
|
||||
void MaxSize(StringType & str, size_t max_size)
|
||||
{
|
||||
if( str.size() > max_size )
|
||||
str.erase(max_size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
wchar_t ToSmall(wchar_t c);
|
||||
void ToSmall(std::wstring & s);
|
||||
|
||||
|
|
Loading…
Reference in New Issue