size_t foundBegin = mystring.find("[");
if (foundBegin!=std::string::npos)
{
size_t foundEnd = mystring.find("]");
if (foundEnd != std::string::npos)
{
// todo
}
}
이것은 내가 지금까지 가지고있는 것입니다. 마커 사이의 문자열에서 공백 제거 C++
는 내가 정확히 어떻게에만 토큰[
와
]
토큰 사이의 제거로 변경하는
mystring.erase(remove_if(mystring.begin(), mystring.end(), isspace), mystring.end());
메신저 확실하지 뭔가를 시도했다. 어떤 도움이라도 대단히 감사합니다 !!!
체크 아웃 [string.substr() (http://www.cplusplus.com/reference/string/ : 그것은 세퍼레이터로서 스페이스를 사용하여 단어 입력 단어 소요 문자열/substr /). – TypeIA
@dvnrrs,'std :: string :: substr'은 새로운 문자열을 생성합니다. 'std :: string :: erase'와'std :: string :: find_first_of'를 조합하면 그의 코드는 트릭을 할 것입니다 – Paranaix
당신은 이미 색인을 알고 있습니다. iterator를 만들어서 begin()과 end() 대신에 iterator를 사용하면된다. – chris