|
이게 간단한 방법같지는 않지만 이런 방법도 있습니다.
#include <string>
#include <algorithm>
//using namespace std;
AnsiString str1("This is a string.");
std::string str2(str1.c_str());
unsigned cnt=std::count(str2.begin(),str2.end(),'s');
라모드 님이 쓰신 글 :
: 만약에 어떤문자열에서 특정문자의 갯수를 구하려면 어떻게 해야 하나요..?
: 문자수만큼 for문을 돌려서 할 수도 있겠지만 더 쉬운방법이 있을것 같은데요..
:
:
|