Strstr () in emacs lisp?

I want to find a string in another (basically what strstr does in C), and I did not find anything in the elisp manual.

Do I need to overestimate all this, or am I missing something obvious?

+4
source share
2 answers

Or you can use regular expressions:

 (string-match-p "foo" "barfoo") 3 

or

 (string-match "foo" "barbar") nil 

See Regexp-Search for details.

+5
source

Lines are sequences. And thus the search will work:

 (search "foo" "in foo-bar") 3 
+12
source

Source: https://habr.com/ru/post/1335389/


All Articles