Skip to content

Boost:StringAlgo

How to use

아래의 헤더를 추가해야 한다.

#include <boost/algorithm/string.hpp>

Example

  • to_upper(std::string): 대문자로 변환
  • to_lower(std::string): 소문자로 변환
  • trim(std::string): 공백 문자 제거
  • iends_with(std::string, ".exe"): .exe로 끝나는 문자열인지 판단
  • find_first(std::string, "dolly"): 문자열에 dolly가 포함되어 있는가? (iterator or bool 반환)
  • replace_first(std::string, "A", "B"): 앞에서 부터 검색하여 A를 B로 치환(1회)
  • replace_last(std::string, "A", "B"): 뒤에서 부터 검색하여 A를 B로 치환(1회)
  • erase_all(std::string, "empty"): empty 문자열을 모두 삭제
  • erase_head(std::string, 6): 앞에서 6 문자열을 삭제
  • split(std::vector<std::string>>, std::string, is_any_of("--"), token_compress_on) 1: 문자열에서 "--"를 모두 찾아서 vector<string> container에 push_back 처리

See also

Favorite site

References


  1. Boost:Tokenizer 사용을 검토해 보자.