Writing Expressions : Manipulating string data : Removing spaces from the ends of strings
 
Removing spaces from the ends of strings
When combining values from multiple fields, the resulting string can sometimes contain extra spaces, as shown in the following example:
Carine  Schmitt
The string has an extra space between the first name and the last name because the first name value contains a space after the name, and the following expression inserts the second space:
row["customerFirstname"] + " " + row["customerLastname"]
To remove spaces from strings, use the BirtStr functions, trim( ), trimLeft( ), or trimRight( ). The trim( ) function removes both leading and trailing space characters, trimLeft( ) removes leading space characters, and trimRight( ) removes trailing space characters.
The following expression uses trim( ) to remove all leading and trailing spaces from both firstName and LastName fields:
BirtStr.trim(row["firstName"]) + " " + BirtStr.trim(row["lastName"])