Index
Main Menu
Tutorial Videos
Tutorial videos are available here.
Knowledge Base
Visit our User Forum for discussions & solutions
January 22, 2011
Testing parts of a string - XpressDox
Working with strings in XpressDox templates
StartsWith
The StartsWith function is used to test whether a string starts with a given string:
«If(StartsWith(Surname,'van ')»«Title» «Surname» is probably of Dutch descent.«End()»
«If(StartsWith(Surname,'van ')»«SetV('LastPart',substring-after(Surname,'van '))»«End()»
In previous versions this command was known as starts-with. Backward compatibility ensures that XpressDox will still recognize this command.
EndsWith
EndsWith tests the end of a string:
«If(EndsWith(Surname,'-Smith')»
«Surname» is a double-barrelled name.
«SetV('FirstPart',substring(Surname,1,string-length(Surname) - 6))»«Comment(SetV('FirstPart',string-before('-Smith')) is equivalent)»
«End()»
contains
contains (an XSLT function) tests for a string anywhere in another string:
«If(contains(Surname,'prmzl'))»«Surname» is not an English name.«End()»
SubstringBefore / SubstringAfter
SubstringBefore and SubstringAfter test for a string which occurs in another string, but either before or after another delimeter:
The first name is «SubstringBefore(FullNames,' ')» and the last part of the name is «SubstringAfter(FullNames,' ')»