added qse_mbsbytes()/qse_wcsbytes()
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: str_bas.c 423 2011-03-31 04:15:24Z hyunghwan.chung $
|
||||
* $Id: str_bas.c 425 2011-04-03 14:57:23Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -22,27 +22,6 @@
|
||||
#include <qse/cmn/chr.h>
|
||||
#include "mem.h"
|
||||
|
||||
qse_size_t qse_mbslen (const qse_mchar_t* mbs)
|
||||
{
|
||||
const qse_mchar_t* p = mbs;
|
||||
while (*p != QSE_MT('\0')) p++;
|
||||
return p - mbs;
|
||||
}
|
||||
|
||||
qse_size_t qse_wcslen (const qse_wchar_t* wcs)
|
||||
{
|
||||
const qse_wchar_t* p = wcs;
|
||||
while (*p != QSE_WT('\0')) p++;
|
||||
return p - wcs;
|
||||
}
|
||||
|
||||
qse_size_t qse_strbytes (const qse_char_t* str)
|
||||
{
|
||||
const qse_char_t* p = str;
|
||||
while (*p != QSE_T('\0')) p++;
|
||||
return (p - str) * QSE_SIZEOF(qse_char_t);
|
||||
}
|
||||
|
||||
qse_char_t* qse_strbeg (const qse_char_t* str, const qse_char_t* sub)
|
||||
{
|
||||
while (*sub != QSE_T('\0'))
|
||||
|
49
qse/lib/cmn/str_len.c
Normal file
49
qse/lib/cmn/str_len.c
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
|
||||
QSE is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
QSE is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <qse/cmn/str.h>
|
||||
|
||||
qse_size_t qse_mbslen (const qse_mchar_t* mbs)
|
||||
{
|
||||
const qse_mchar_t* p = mbs;
|
||||
while (*p != QSE_MT('\0')) p++;
|
||||
return p - mbs;
|
||||
}
|
||||
|
||||
qse_size_t qse_wcslen (const qse_wchar_t* wcs)
|
||||
{
|
||||
const qse_wchar_t* p = wcs;
|
||||
while (*p != QSE_WT('\0')) p++;
|
||||
return p - wcs;
|
||||
}
|
||||
|
||||
qse_size_t qse_mbsbytes (const qse_mchar_t* str)
|
||||
{
|
||||
const qse_mchar_t* p = str;
|
||||
while (*p != QSE_MT('\0')) p++;
|
||||
return (p - str) * QSE_SIZEOF(qse_mchar_t);
|
||||
}
|
||||
|
||||
qse_size_t qse_wcsbytes (const qse_wchar_t* str)
|
||||
{
|
||||
const qse_wchar_t* p = str;
|
||||
while (*p != QSE_WT('\0')) p++;
|
||||
return (p - str) * QSE_SIZEOF(qse_wchar_t);
|
||||
}
|
Reference in New Issue
Block a user