Substringing a variable length string


I have an element whose content is a string which varies in size. Examples - The string could look like Stocks 12% of Posts or Micellaneous Assets 14% of Posts. So the only thing in common is the percentage sign and the text after this. However I only want to display the text before the percentage value ie in these cases I only want to show Stocks and Micellaneous Assets. How could i split up the element to do this?


How about the following?

Try to use XML as opposed to “data strings”.

I have figured ou a way of doing it. I first used the substring before method to get all chars before the % sign and then traslated any numbers to blanks.


Try this:
substring-before(“Stocks 12% of Posts”,"% of Posts")
“Stocks 12"

Removing the trailing " 12” may be accomplished using substring() and string-length()
provided you know e.g. that the number is always 2 digits wide.