• 常用的函数——M


    1.$Piece(简写$P):

      格式:$Piece(expression, delimiter [,from[, to]])

      返回一个或多个被分隔符分开的子串

      例子:

        set String="Jack ^123 Any Street^Any Town^USA^12045"

        For I=1:1:$L(String,"^") Write !,$P(String,,"^", I)

    2.$Order(简写$O):

      格式:$Order(variable[,direction])

      按照指定的方向返回一个变量的上一个或下一个索引

    3.$Get(简写$G):

      返回一个变量的值

      如果变量存在则返回变量本身,不存在则返回空

    4.$Data(简写$D):

      判断变量是否存在

    5.$Justify(简写$J):

      格式:$Justify(expression,width[,desimal])

      说明:返回一个右对齐的值,并可以改变它的格式。

    6.$Extract(简写$e):

      格式:$Extract(expression,[,from[,to]])

      说明:返回字符串的指定部分。

      >Write $Extract("AABB",2,3)

       AB

    7.$Replace

      格式:$replace(variable,str1,str2)

      说明:替换字符

      s str=”abc”

      w $replace(str,”a”,”d”)

    8.$translate(简写$tr)

      格式:$TRANSLATE(string,identifier[,associator])

    9.$Length(简写$L):

      格式:$Length(expression[,delimiter])

      说明:返回一个字符串的长度,或者是被分隔符的子串的个数

      >Write $Length("ABCD")

      4

    10.$zconert(简写$zcvt) 

      >Write $zcvt(str,”U”)

    11.$Find(简写$F)

      说明:第一个参数是字符串,第二个参数是寻找的子串。功能:寻找字符串子串的位置,返回值是子串所在位置加1,没有找到返回0。

      举例:

        set x="This is a test."

        Write !,$F(x,"T")

  • 相关阅读:
    LeetCode-Cycle Detection,Find the Duplicate Number
    LeetCode-Symmetric Tree
    剑指offer-打印链表倒数第k个结点
    Http协议中Get和Post的区别
    ORDER BY 语句
    AND 和 OR 运算符
    WHERE 子句
    SQL SELECT DISTINCT 语句
    SQL SELECT 语句
    SQL DML 和 DDL
  • 原文地址:https://www.cnblogs.com/Life-is-Demo/p/11132748.html
Copyright © 2020-2023  润新知