zoukankan      html  css  js  c++  java
  • Makefile中的字符串处理函数

    Makefile中的字符串处理函数

    参考:https://seisman.github.io/how-to-write-makefile/functions.html#patsubst

    subst

    功能:把字串 <text> 中的 <from> 字符串替换成 <to>

    $(subst <from>,<to>,<text>)
    

    返回:函数返回被替换过后的字符串。

    patsubst

    功能:以模式匹配的方式来替换字符串,查找 <text> 中的单词是否符合模式 <pattern> ,如果匹配的话,则以 <replacement> 替换。这里, <pattern> 可以包括通配符 % ,表示任意长度的字串。如果 <replacement> 中也包含 % ,那么, <replacement> 中的这个 % 将是 <pattern> 中的那个 % 所代表的字串。

    $(patsubst <pattern>,<replacement>,<text>)
    

    返回:函数返回被替换过后的字符串。

    strip

    功能:去掉空格

    $(strip <string>)
    

    返回:返回被去掉空格的字符串值。

    findstring

    功能:在字串 <in> 中查找 <find> 字串。

    $(findstring <find>,<in>)
    

    返回:如果找到,那么返回 <find> ,否则返回空字符串。

    filter

    功能:以<pattern>模式过滤<text>中的单词,保留符合<pattern>的单词,可以有多个模式。

    $(filter <pattern...>,<text>)
    

    返回:返回符合<pattern>的字符串

    filter-out

    功能:反过滤函数,和上面filter正好相反。

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

    返回:返回不符合模式 <pattern> 的字串。

    sort

    功能:给字符串 <list> 中的单词排序(升序)。

    $(sort <list>)
    

    返回:返回排序后的字符串。

    word

    功能:取字符串 <text> 中第 <n> 个单词。(从1开始)

    $(word <n>,<text>)
    

    返回:返回字符串 <text> 中第 <n> 个单词。如果 <n><text> 中的单词数要大,那么返回空字符串。

    wordlist

    功能:从字符串 <text> 中取从 <ss> 开始到 <e> 的单词串。 <ss><e> 是一个数字。

    $(wordlist <ss>,<e>,<text>)
    

    返回:返回字符串 <text> 中从 <ss><e> 的单词字串。如果 <ss><text> 中的单词数要大,那么返回空字符串。如果 <e> 大于 <text> 的单词数,那么返回从 <ss> 开始,到 <text> 结束的单词串。

    words

    功能:统计 <text> 中字符串中的单词个数。

    $(words <text>)
    

    返回:返回 <text> 中的单词数。

    firstword

    功能:取首个单词

    $(firstword <text>)
    

    返回:返回字符串 <text> 的第一个单词。

  • 相关阅读:
    react-router刷新页面Cannot GET 问题
    react学习之弹出层
    react学习之js-xlsx导入和导出excel表格
    c#串口通信并处理接收的多个参数
    react与微信小程序
    promise知识点小结
    汇编命令小记
    Firebase-config 在android中的使用
    python:html元素解析
    Toast实现源码解析
  • 原文地址:https://www.cnblogs.com/wangha/p/13292823.html
Copyright © 2011-2022 走看看