Splitting of strings based on the required length

后端 未结 1 1586
轮回少年
轮回少年 2021-01-22 11:04

Is there an easy way on how to split a string based from the required length? For example, I have a string:

AAAAABBBBB1111122222RRRRR

相关标签:
1条回答
  • You can use analyze-string to break up the data:

    <xsl:template match="Data">
        <xsl:variable name="tokens" as="xs:string*">
            <xsl:analyze-string select="." regex=".{{1,5}}">
                <xsl:matching-substring>
                    <xsl:sequence select="."/>
                </xsl:matching-substring>
            </xsl:analyze-string>
        </xsl:variable>
        <xsl:value-of select="$tokens" separator="&#10;"/>
    </xsl:template>
    
    0 讨论(0)
提交回复
热议问题