2014-01-21 2 views

답변

3

사용 string-contains :

> (require srfi/13) 
> (string-contains "this is an example" "example") 
11 
> (string-contains "this is an example" "hexample") 
#f 
3

라켓에서이에 대한 일반적인 메커니즘은 regular expressions 있습니다

(regexp-match "example" "this is an example") 
=> '("example") 

(regexp-match-positions "example" "this is an example") 
=> '((11 . 18)) 

정규 표현식 처리 문자열의 약간 복잡하지만 매우 강력한 방법입니다. 검색 문자열을 별도의 단어로 사용해야하는지 반복 패턴이나 문자 클래스를 검색할지 지정할 수 있습니다. 이에 대한 훌륭한 Racket 문서를 참조하십시오.

관련 문제