Left and Right Functions – XpressDox

The Left function extracts the left most characters from a string

 

 

The Substring function in XpressDox

The substring function provides all the functionality to extract pieces of a string, but Left and Right make some operations easier. Left returns the leftmost characters, and Right the rightmost characters.

 

 

The Left and Right functions in XpressDox

In particular, extracting a substring at the end of a string can be quite complicated, needing knowledge of the length of the string, for example.

If a data element Name contains “Frederick Basset”, then the function

«Right(Name,3)»

will return “set”. This is equivalent to «substring(Name,string-length(Name)- 2,3)»

«Left(Name,4)»

will return “Fred”.

If the number of characters requested is more than the length of the source string, then the entire source string is returned.