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:
Tomasz Sowa 2012-02-14 20:35:35 +00:00
parent f381f24402
commit 9d2be5c50d
1 changed files with 10 additions and 1 deletions

View File

@ -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);