20 this->
Copy (lpctszString);
46 return Len () *
sizeof (TCHAR);
51 if (
_lptszString == NULL && lpctszString == NULL)
return TRUE;
52 if (
_lptszString == NULL || lpctszString == NULL)
return FALSE;
57 return result == 0 ? TRUE : FALSE;
65 return result == 0 ? TRUE : FALSE;
80 this->
Copy (lpctszString);
90 this->
Add (lpctszString);
106 wsprintf (tszBuf, _T (
"%d"), iValue);
115 string += lpctszString;
123 baseString += string;
130 this->
Add (lpctszString);
137 this->
Add (
string.
Ptr ());
146 return response < 0 ? true :
false;
153 if (index <= this->
Len ())
168 int iLen = this->
Len ();
170 for (
int i = 0; i < iLen; i++)
179 for (
int i = 0; i < (iLen - iStartPos); i++)
192 int iLen = this->
Len ();
194 for (
int i = (iLen - 1); i >= 0; i--)
203 for (
int i = (iLen - 1); i > iStartPos; i--)
222 int len = this->
Len ();
223 int targetLen = startPos + length;
224 if (targetLen > len || targetLen == 0)
return response1;
226 int cutSize = length > 0 ? length + 1 : len - startPos + 1;
227 TString response2 (cutSize +
sizeof (TCHAR));
228 LPTSTR p = lstrcpyn (response2.
Ptr (), &
_lptszString[startPos], cutSize);
235 int findPos = this->
Find (charsBefore);
236 if (findPos == -1)
return *
this;
239 returnString += charsAfter;
241 returnString += wordsAfter;
253 int findPos = tempString.
Find (charsBefore);
254 if (findPos == -1)
return tempString;
256 returnString = tempString.
Substring (0, findPos);
257 returnString += charsAfter;
260 returnString += wordsAfter;
261 tempString = returnString;
269 int length = this->
Len ();
275 for (
int i = 0; i <= length; i++)
279 for (
int j = 0; j < delimiters.
Len () + 1; j++)
281 delimiter = delimiters[j];
282 if (check == delimiter)
285 LPTSTR p = lstrcpyn (
302 LPCTSTR pctszS2 = keyword.
Ptr ();
304 int len = keyword.
Len ();
306 if (pctszS1 == NULL && pctszS2 == NULL)
311#pragma warning(disable:28182)
314 if (*pctszS1 == *pctszS2)
325 }
while (*pctszS1 !=
'\0' && *pctszS2 !=
'\0' && len != 0);
328 response = len == 0 ? pos : -1;
330 return response == -1 ? -1 : response + position;
338 va_start (args, format);
341 len = (_vsctprintf (format, args) + 1) *
sizeof (TCHAR);
353 DWORD dwWideSize = ::MultiByteToWideChar (
354 codePage, MB_PRECOMPOSED, lpcszSJIS, -1,
nullptr, 0);
357 DWORD dwResponse = ::MultiByteToWideChar (
358 codePage, MB_PRECOMPOSED, lpcszSJIS, -1, response.
Ptr (), dwWideSize);
361 return dwResponse > 0 ? TRUE : FALSE;
366 return ::WideCharToMultiByte (
367 CP_ACP, 0,
_lptszString, -1, lpszSJIS, dwLen, NULL, NULL);
375 auto power10 = [](
int up)
377 if (up == 0)
return 1;
381 for (
int i = 1; i < up; i++)
389 for (
int i = (
Len () - 1); i >= 0; i--)
397 value += (t -
'0') * power10 (n++);
413 LPTSTR lptszMemory =
new TCHAR[
size +
sizeof (TCHAR)];
414 ZeroMemory (lptszMemory, (
size +
sizeof (TCHAR)));
423 DWORD dwLen =
Length (lpctszString);
426 LPCTSTR lpctszSrc = (LPTSTR)lpctszString;
427 while ((*lpctszSrc) !=
'\0')
429 *lptszDst++ = *lpctszSrc++;
440 static_cast<ULONGLONG
>(this->
Len ()) +
441 Length (lpctszString) +
sizeof (TCHAR);
444 if (lpctszString) lstrcat (lptszNewBuffer, lpctszString);
451 LPCTSTR lpctszString1, LPCTSTR lpctszString2,
int size)
const
455 LPCTSTR lpctszS1 = lpctszString1;
456 LPCTSTR lpctszS2 = lpctszString2;
460 if ((response = *lpctszS1 - *lpctszS2++) != 0 || !*lpctszS1++)
473 if (lpctszString != NULL)
475 while (lpctszString[i] != NULL)
文字列に関するWindowsAPIを集約したクラス
文字列に関するWindowsAPIを集約したクラス
VOID APIENTRY Copy(LPCTSTR lpctszString)
skeleton::Array< TString > APIENTRY Split(const TString &delimiters)
文字列を指定した文字列で分割します。
TCHAR APIENTRY operator[](int index) const
文字列の一部を取り出します。
LPTSTR APIENTRY CreateMemory(ULONGLONG size)
TString &APIENTRY Format(LPCTSTR format,...)
フォーマットに従ってパラメータを文字列化します。
INT APIENTRY Length(LPCTSTR lpctszString) const
INT APIENTRY Byte() const
内部で確保している文字列(バイト数)を取得します。
APIENTRY TString()
コンストラクタ
int APIENTRY Compare(LPCTSTR lpctszString1, LPCTSTR lpctszString2, int size) const
APIENTRY ~TString()
デストラクタ
VOID APIENTRY operator=(LPCTSTR lpctszString)
文字列を代入します。
TString &APIENTRY Trim()
左右の余白を切り取ります。
INT APIENTRY Len() const
内部で確保している文字列数を取得します。
TString APIENTRY Replace(TString &charsBefore, TString &charsAfter)
文字列を置換します。
LPCTSTR APIENTRY Ctr() const
内部で確保している文字列ポインタを取得します。
BOOL APIENTRY operator!=(LPCTSTR lpctszString) const
文字列と比較します。
TString &APIENTRY TrimRight()
右側の余白を切り取ります。
int APIENTRY ToSJIS(LPSTR lpszSJIS, DWORD dwLen)
SJIS文字列を出力します。
TString APIENTRY ReplaceAll(TString &charsBefore, TString &charsAfter)
文字列を置換します。
VOID APIENTRY Add(LPCTSTR lpctszString)
TString &APIENTRY operator<<(LPCTSTR lpctszString)
文字列を代入します。
BOOL APIENTRY operator==(LPCTSTR lpctszString) const
文字列と比較します。
TString APIENTRY operator+(LPCTSTR lpctszString)
文字列を追加します。
TString APIENTRY Substring(int startPos, int length=0)
文字列を切り出します。
int APIENTRY Find(TString keyword, int position=0)
文字列を検索します。
TString &APIENTRY TrimLeft()
左側の余白を切り取ります。
TString &APIENTRY operator+=(LPCTSTR lpctszString)
文字列を追加します。
LPTSTR APIENTRY Ptr() const
内部で確保している文字列ポインタを取得します。
int APIENTRY ParseInt() const
文字列の数値化
BOOL APIENTRY FromMultiByte(LPCSTR lpcszSJIS, UINT codePage=CP_ACP)
マルチバイト文字列を取り込みます。
bool APIENTRY operator<(const TString &string) const
文字列の大小を比較します。
VOID APIENTRY Add(T &item)
Array<T>へ値を追加