XPath、XQuery 以及 XSLT 函數

[color=red]有關字符串的函數[/color]

[color=blue]fn:substring(string,start,len) [/color]

返回從 start 位置開始的指定長度的子字符串。第一個字符的下標是 1。如果省略 len 參數,則返回從位置 start 到字符串末尾的子字符串。

例子:substring('Beatles',1,4)

結果:'Beat'

[color=blue]fn:substring-before(string1,string2)[/color]

返回 string2 在 string1 中出現之前的子字符串。

例子:substring-before('12/10','/')

結果:'12'

[color=blue]fn:substring-after(string1,string2)[/color]

返回 string2 在 string1 中出現之後的子字符串。

例子:substring-after('12/10','/')

結果:'10'
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章