The character string to be modified.
The position within a character string to begin the replacement of characters. Numeric
The number of characters to replace in a character string. If the Number_Of_Characters parameter is 0, Alpha Anywhere inserts the Insert_String at the given start_position. Numeric
The character string to insert into a character string. If Insert_String is empty, the specified Number_Of_Characters is deleted at the start_position.
Alters a string by deleting characters and replacing them with another string.
Replaces the specified Number_Of_Characters in a character string, beginning at the specified start_position, with the Insert_String.
STUFF() enables you to insert a string within another string, without the extra steps involved in dividing the target string into two pieces (using the SUBSTR() command), and then reconstructing it by concatenating the two original pieces with the new string.
stuff("Let them eat duck", 14, 4, "cake") -> "Let them eat cake"
Here is how the expression works:
The initial string: " Let them eat duck"
The 14th character in the string: "d"
The string with four characters removed: "Let them eat "
The final string: "Let them eat cake"
Here is a more practical example. Assume your table contains a field called FULLNAME, which contains names in the format "Ken Smith." You want to print a report showing each person's first initial and last name (e.g., "K. Smith."). You can define and place a calculated field that uses the following expression:
stuff(FULLNAME, 2, (at(" ", FULLNAME) - 2), ".")
Another expression that achieves the same result is:
substr(FULLNAME, 1, 1) + ". " + " " + word(FULLNAME, 2)