$Id: string.xsl 69482 2017-10-28 13:30:36Z vboxsync $
Ball
Steve
2002
2001
Steve Ball
String Processing
Introduction
This module provides templates for manipulating strings.
Make string uppercase
Converts all lowercase letters to uppercase.
text
The string to be converted
Returns string with all uppercase letters.
ß
S
S
Make string lowercase
Converts all uppercase letters to lowercase.
text
The string to be converted
Returns string with all lowercase letters.
Capitalise string
Converts first character of string to an uppercase letter. All remaining characters are converted to lowercase.
text
The string to be capitalised
all
Boolean controlling whether all words in the string are capitalised.
Default is true.
Returns string with first character uppcase and all remaining characters lowercase.
Convert a string to one camelcase word
Converts a string to one lowerCamelCase or UpperCamelCase
word, depending on the setting of the "upper"
parameter. UpperCamelCase is also called MixedCase while
lowerCamelCase is also called just camelCase. The template
removes any spaces, tabs and slashes, but doesn't deal with
other punctuation. It's purpose is to convert strings like
"hollow timber flush door" to a term suitable as identifier or
XML tag like "HollowTimberFlushDoor".
text
The string to be capitalised
upper
Boolean controlling whether the string becomes an
UpperCamelCase word or a lowerCamelCase word.
Default is true.
Returns string with first character uppcase and all remaining characters lowercase.
String extraction
Extracts the portion of string 'text' which occurs before any of the characters in string 'chars'.
text
The string from which to extract a substring.
chars
The string containing characters to find.
Returns string.
String extraction
Extracts the portion of string 'text' which occurs after the last of the character in string 'chars'.
text
The string from which to extract a substring.
chars
The string containing characters to find.
Returns string.
String extraction
Extracts the portion of string 'text' which occurs before the first character of the last occurance of string 'chars'.
text
The string from which to extract a substring.
chars
The string containing characters to find.
Returns string.
String substitution
Substitute 'replace' for 'with' in string 'text'.
text
The string upon which to perform substitution.
replace
The string to substitute.
with
The string to be substituted.
disable-output-escaping
A value of yes indicates that the result should have output escaping disabled. Any other value allows normal escaping of text values. The default is to enable output escaping.
Returns string.
no
Count Substrings
Counts the number of times a substring occurs in a string. This can also counts the number of times a character occurs in a string, since a character is simply a string of length 1.
Counting Lines
]]>
text
The source string.
chars
The substring to count.
Returns a non-negative integer value.
0
0
String extraction
Extracts the portion of a 'char' delimited 'text' string "array" at a given 'position'.
text
The string from which to extract a substring.
chars
delimiters
position
position of the elements
all
If true all of the remaining string is returned, otherwise only the element at the given position is returned. Default: false().
Returns string.
String extraction
Extracts the portion of a 'char' delimited 'text' string "array" at a given 'position'
text
The string from which to extract a substring.
chars
delimiters
position
position of the elements
Returns string.
String insertion
Insert 'chars' into "text' at any given "position'
text
The string upon which to perform insertion
position
the position where insertion will be performed
with
The string to be inserted
Returns string.
String reversal
Reverse the content of a given string
text
The string to be reversed
Returns string.
Format a string
Inserts newlines and spaces into a string to format it as a block of text.
text
String to be formatted.
max
Maximum line length.
indent
Number of spaces to insert at the beginning of each line.
justify
Justify left, right or both. Not currently implemented (fixed at "left").
Formatted block of text.
Find first occurring character in a string
Finds which of the given characters occurs first in a string.
text
The source string.
chars
The characters to search for.
Match A String To A Pattern
Performs globbing-style pattern matching on a string.
Match Pattern
]]>
text
The source string.
pattern
The pattern to match against. Certain characters have special meaning:
*
Matches zero or more characters.
?
Matches a single character.
\
Character escape. The next character is taken as a literal character.
Returns "1" if the string matches the pattern, "0" otherwise.
1
1
0
0
1
0
1
0
0
Create A Repeating Sequence of Characters
Repeats a string a given number of times.
text
The string to repeat.
count
The number of times to repeat the string.