make内置函数之字符串处理

make中主要有下面几个字符串处理相关的内置函数

1)filter 函数会将text视为一系列被空格隔开的单词,会返回与pattern匹配的单词。

$(filter pattern ..., text)

2)filter-out 函数所做的事情刚好跟filter相反,用来选出与pattern不匹配的单词。

$(filter-out pattern ..., text)

3)findstring 函数用来在text中查找string,如果string被找到了,那么该函数返回string,否则返回为空。

$(findstring string ..., text)

4)subst 函数用来在text中查找search-string,如果找到了就将其替换为replace-string,这是一种简单的、非通配的匹配和替换。

$(subst search-string, replace-string, text)

5)patsubst 函数如同subst,不过它是一种支持通配的匹配。

$(patsubst search-string, replace-string, text)

6)word 函数返回text中单词的数量

$(word text)

7)下面这个函数返回text中第n个单词,单词的下标从 1 开始,如果n大于text中单词的数量,则返回为空。

$(word n, text)

8)firstword 函数返回text中的第一个单词,等同于$(word 1, text)

$(firstword text)

9)wordlist 函数返回text中下标从start到end的单词,包括start 和 end。

$(wordlist start, end, text)

10)sort 函数对list中的元素进行排序并去重。

$(sort list)


 

猜你喜欢

转载自blog.csdn.net/choumin/article/details/111515336
今日推荐