SQL Eval Function String_TrimEnd

String_TrimEnd removes all trailing occurrences of a set of characters specified in charsToTrimStr string from the the source string.

String_TrimEnd (
	@source NVARCHAR (MAX),
	@charsToTrimStr NVARCHAR (MAX)
	)
RETURNS NVARCHAR (MAX)

Parameters

  • source: The source string.
  • charsToTrimStr: A string that is converted to an array of Unicode characters to remove, or null.

Returns

  • The string that remains after all white-space characters are removed from the start and end of the source string.
  • If no characters can be trimmed from the source instance, the method returns it without any changes.

Example

SELECT SQLNET::String_TrimEnd('*John Doe/', '*/')

String_TrimEnd4k

It is equivalent to String_TrimEnd except no NVARCHAR(MAX) parameters; it can be used when input data will never be over 4000 characters as this function offers better performance.

String_TrimEnd4k (
	@source NVARCHAR (4000),
	@charsToTrimStr NVARCHAR (4000)
	)
RETURNS NVARCHAR (4000)

Example

SELECT SQLNET::String_TrimEnd4k('*John Doe/', '*/')


Contents