strcontains 함수

strcontains 함수

strcontains 함수는 어떤 문자열 안에 특정 부분 문자열(substring)이 포함되어 있는지 확인해주는 내장 함수예요.

출처: 문서

본문

strcontains(string, substr)은 첫 번째 인자 string 안에 두 번째 인자 substr가 포함되어 있으면 true를, 아니면 false를 돌려줘요.

> strcontains("hello world", "wor")
true
 
> strcontains("hello world", "wod")
false

예시에서 알 수 있듯이, 연속된 정확한 부분 문자열이어야 true를 반환해요.

더 알아보기 (Learn more)