系列目录

InterSystems Ensemble学习笔记(一) Ensemble介绍及安装
InterSystems Ensemble学习笔记(二) Ensemble创建镜像, 实现自动故障转移

InterSystems Ensemble学习笔记(三) 基础语法

一、坑太多

       转眼离上一次学习Ensemble写笔记,已经三年多了,老外的软件坑太多,对基础语法做些笔记。

 

///$F字符串查找
#dim newString as %String
set newString="1234567890abcdefgh"
set innum=$F(newString,"1")
$$$LOGINFO("["_innum_"]")

输出:2

 

///$F字符串查找,位置定位在字符串后
#dim newString as %String
set newString="1234567890abcdefgh"
set innum=$F(newString,"456")
$$$LOGINFO("["_innum_"]")

输出:7

 

///$E字符串截取
#dim newString as %String
set newString="1234567890abcdefgh"
set innum=$E(newString,7,*)
$$$LOGINFO("["_innum_"]")    


输出:7890abcdefgh

 

///$P字符串截取。第三个参数1,是向前截取,2是向后截取
        #dim newString as %String
        set newString="1234567890abcdefgh"
        set innum=$P(newString,"456",1)
        $$$LOGINFO("["_innum_"]")

输出:123

 

///$P字符串截取。第三个参数1,是向前截取,2是向后截取
        #dim newString as %String
        set newString="1234567890abcdefgh"
        set innum=$P(newString,"456",2)
        $$$LOGINFO("["_innum_"]")

输出7890abcdefgh

 

posted on 2021-09-14 13:43  yi-sheng  阅读(68)  评论(0编辑  收藏  举报