Crystal Reports for Rational Application Developer Designer Guide

Length (str)

Length and Len (str) are equivalent functions.
Examples
Length("Account")
Returns 7.
Length("Text_String") 
Returns 11.
Length("__Center__")
Returns 10.
Length(ToText({orders.ORDER AMOUNT})) 
Returns 9, where {orders.ORDER AMOUNT} is 14233.08, and ToText ({orders.ORDER AMOUNT}) returns the String "14,233.08". Here, the comma and period have been specified in the Number format for the formula field as the thousands and decimal separators respectively,
Length(ToText({orders.ORDER AMOUNT}, 2, "", ".")) 
Returns 8 where {orders.ORDER AMOUNT} = 14233.08, and ToText ({orders.ORDER AMOUNT}, 2, "", ".") returns the String "14233.08". Here, the null character and period have been specified in the Number format for the formula field as the thousands and decimal separators respectively.
Length("BOB")
Returns 3.
Length("SMITH")
Returns 5.
Length("BOB SMITH")
Returns 9. (The blank space between BOB and SMITH is counted as a character.)
Length({customer.CUSTOMER NAME})
The length of the text string stored as a value in {customer.CUSTOMER NAME}.
{customer.CUSTOMER NAME}[Length({customer.CUSTOMER NAME})-2]
Returns the third character from the right in the Customer Name. This can also be used to extract a substring from a String that always starts at a fixed position from the end of the String.
In the following example, an address line contains the province name and postal code. Full province names are of different lengths, but the first character of the postal code is always the seventh from the last character. The formula determines the length of the address line, subtracts 7 from it, and uses the result to identify the first character of the postal code in the address line.
Local StringVar addressLine;
Local NumberVar addrLength;
addressLine := "British Columbia V6X 3W2";
addrLength := Length (addressLine);
addressLine [addrLength-7+1 to addrLength]



Business Objects, an SAP company
http://www.businessobjects.com/
Support services
http://www.businessobjects.com/services/support/
Product Documentation on the Web
http://support.businessobjects.com/documentation/