
std::string::substr
·
공부/Code Cata
std::string substr(size_t pos = 0, size_t len = npos) const; pos:부분 문자열이 시작될 Index이다.기본값은 0이며, 해당 Index부터 값이 추출된다.len:추출할 문자열의 길이다.기본값은 npos로, 이 경우 pos부터 문자열 끝까지 추출한다.주어진 위치와 길이에 해당하는 부분 문자열을 반환하고 반환 값은 새롭게 생성된 std::string이다. #include #include using namespace std;string solution(string s) { string answer = ""; int StringLength = s.size(); if(StringLength % 2 == 0) { int Ta..