LTrim()

LTrim()

是字元或二進位數據表達式。character_expression 可以是常量、變數或列。character_expression 必須是可以隱性轉換為 varchar 的數據類型。否則,使用 CAST 顯式轉換 character_expression。

基本信息


LTrim()函數 去掉字元串截去首尾連續空白 .
表達式 String LTrim('源字元串'),
'源字元串',輸入類型為字元,需要處理的源字元串。
asp 實例:
<%
strTest = " This is a test!"
response.write LTrim(strTest)
%>
返回結果: This is a test!
.net 實例:
logic.aspx
<%@ Page language="c#" AutoEventWireup="false" Inherits="NoahWeb.Engine" %>
"
charset=gb2312">
NoahWeb示範
邏輯層輸出位點
邏輯層示例
此示例需要存在文件"logic.aspx"和當前名稱空間下具有"viewmsg"字元資源。
<Action name="logic.demo" NextAction="">
示例輸出
[a b c d]

LTRIM


刪除起始空格后返回字元表達式。
語法 LTRIM (character_expression )
參數 character_expression
是字元或二進位數據表達式。c haracter_expression 可以是常量、變數或列。 character_expression 必須是可以隱性轉換為 varchar 的數據類型。否則,使用 CAST 顯式轉換 character_expression。
varchar
註釋 兼容級別可能影響返回值。有關兼容級別的更多信息,請參見 sp_dbcmptlevel。
示例 下例使用 LTRIM 字元刪除字元變數中的起始空格。
DECLARE @string_to_trim varchar(60) SET @string_to_trim = ' Five spaces are at the beginning of this string.' SELECT 'Here is the string without the leading spaces: ' + LTRIM(@string_to_trim)GO 下面是結果集:
Here is the string without the leading spaces: Five spaces are at the beginning of this string. (1 row(s) affected)
  • 目錄