Topic group Related topics
Returns a string with specified characters removed and others inserted in their place.
STUFF(<target expC>, <start expN>, <quantity expN>, <replacement expC>)
The string you want to remove characters from and replace with new characters.
The character position in the string at which you want to start removing characters.
The number of characters you want to remove from the string.
The characters you want to insert in the string.
STUFF( ) returns a target character expression with a replacement character string inserted at a specified position. Starting at the position you specify, <start expN>, STUFF( ) removes a specified number, <quantity expN>, of characters from the original string.
If the target character expression is an empty string, STUFF( ) returns the replacement string.
If <start expN> is less than or equal to 0, STUFF( ) treats <start expN> as 1. If <quantity expN> is less than or equal to 0, STUFF( ) inserts the replacement string at position <start expN> without removing any characters from the target.
If <start expN> is greater than the length of the target, STUFF( ) doesn’t remove any characters and appends the replacement string to the end of the target.
If the replacement string is empty, STUFF( ) removes the characters specified by <quantity expN> from the target, starting at <start expN>, without adding characters.
The stuff( ) method is almost identical to the STUFF( ) function, but in addition to the syntactic difference of being a method instead of a function and the fact that the position is zero-based, the replacement string is optional, and defaults to an empty string.