본문 바로가기

MFC

[MFC] 특정 문자로 끝나는지 확인하는 방법

728x90
반응형
BOOL IsEndWithChar(CString strCheckString, char endChar)
{
    return (strCheckString.ReverseFind(endChar) == strCheckString.GetLength() - 1);
}

CString str = "C:\\Temp\\";
BOOL bEndOK = IsEndWithChar(str, '\\');   // TRUE

CString str = "C:\\Temp";
BOOK bEndNot = IsEndWithChar(str, '\\');   // FALSE



반응형