"카타 8급 Remove exclamation marks"의 두 판 사이의 차이

잔글 (봇: 카타 8급 PHP 분류 추가)
잔글 (봇: 자동으로 텍스트 교체 (-분류:PHP +))
34번째 줄: 34번째 줄:


[[분류:C++]]
[[분류:C++]]
[[분류:PHP]]
 
[[분류:카타 8급 PHP]]
[[분류:카타 8급 PHP]]

2019년 2월 3일 (일) 04:03 판

1 개요

카타 8급 C
# 🔗 문제 풀이

틀:카타 8급-30

2 C++

#include <string>

std::string removeExclamationMarks(std::string str){
  str.erase(std::remove(str.begin(), str.end(), '!'), str.end());
  return str;
}
#include <string>

std::string removeExclamationMarks(std::string str){
  size_t pos = 0;
  while((pos=str.find("!",pos)) != std::string::npos) str = str.replace(pos, 1, "");
  return str;
}

3 PHP

function remove_exclamation_marks($string) {
  return str_replace('!', '', $string);
}

4 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}