Remove character from string
i have one variable $serviceName = "ZSM开发者_如何学运维eter". i have to remove "S" from this string and get "ZMeter". how i can solve it. thanks in advance.
translate($serviceName, 'S', '')
concat(
substring($serviceName, 1, 1),
substring($serviceName, 3)
)
pardon my xsl... but hope it ll help
<xsl:variable name="frst" select="substring-before($serviceName,'S')" />
<xsl:variable name="after" select="substring-after($serviceName,'S')" />
<xsl:variable name=serviceName select="concat($frst,$after)" />
replace($serviceName, '^ZSMeter$', 'ZMeter')
in case you're with XSLT 2.0.
精彩评论