系列目录
InterSystems 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