diff --git a/README.md b/README.md index ffe6f75..0a8381b 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,8 @@ It starts with a beginner's guide, followed up by some medium-advanced concepts. @@ -1088,7 +1090,7 @@ BAR=a,b,c ### A4.2 - Functions for String Manipulation -
+

patsubst

- replaces string patterns
``` @@ -1165,11 +1167,38 @@ RESULT == a b c ```
+
+

findstring

- looks for occurrences of a string
+ +``` +$(findstring find,in) +``` + +If the text `in` contains a word identical to `find`, the function returns `find`. Otherwise, it returns the empty string. + +Here's an example ([code/18-findstring-example](code/18-findstring-example)): + +```Makefile +NAME = Nuno Jesus + +all: + echo Result=$(findstring Jesus, $(NAME)) + echo Result=$(findstring Miguel, $(NAME)) +.SILENT: +``` + +Output: + +``` +Result=Jesus +Result= +``` + +