added: to methods Toull(), Toll(), Toul(), Toui(), Tol(), Toi()
a new parameter: bool allow_skip_whitechars default true added: new methods: Toull_b(), Toll_b(), Toul_b(), Toui_b(), Tol_b(), Toi_b() automatically detects the base (radix): 4323 - base 10 0122 - base 8 (string starts with 0) #fff - base 16 (string starts with #) &101 - base 2 (string starts with &) added: CharType * SkipWhiteFromBack(CharType * str, bool check_additional_chars = true, bool treat_new_line_as_white = true) skipping white characters from the end of a string changed: Toll_b(), Toull_b(), Tol_b() and Toul_b() are used in Space now for methods ToInt() etc so we are able to use a different base now changed: some work in Space (const correctness) git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1070 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -61,6 +61,38 @@ CharType * SkipWhite(CharType * str, bool check_additional_chars = true, bool tr
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* str_end is pointing at the end of the string (the last item + one)
|
||||
*
|
||||
* return value is a pointer to the first white character after a non-white character at the end
|
||||
* or to the last+one if there is no any white characters
|
||||
*
|
||||
*/
|
||||
template<class CharType>
|
||||
CharType * SkipWhiteFromBack(CharType * str_begin, CharType * str_end, bool check_additional_chars = true, bool treat_new_line_as_white = true)
|
||||
{
|
||||
while( str_end > str_begin && IsWhite(static_cast<wchar_t>(*(str_end-1)), check_additional_chars, treat_new_line_as_white) )
|
||||
{
|
||||
str_end -= 1;
|
||||
}
|
||||
|
||||
return str_end;
|
||||
}
|
||||
|
||||
|
||||
template<class CharType>
|
||||
CharType * SkipWhiteFromBack(CharType * str, bool check_additional_chars = true, bool treat_new_line_as_white = true)
|
||||
{
|
||||
CharType * str_begin = str;
|
||||
|
||||
while( *str != 0 )
|
||||
{
|
||||
str += 1;
|
||||
}
|
||||
|
||||
return SkipWhiteFromBack(str_begin, str, check_additional_chars, treat_new_line_as_white);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user