-
LTrim()
鎖定
LTrim()基本信息
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" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>NoahWeb示範</title>
</head>
<body>
<!-- #BeginLibraryItem "/Library/lout.lbi" -->邏輯層輸出位點<!-- #EndLibraryItem -->
</body>
</html>
邏輯層示例
此示例需要存在文件"logic.aspx"和當前名稱空間下具有"viewmsg"字符資源。
<Action name="logic.demo" NextAction="">
<Out Area="/Library/lout.lbi">
<SetVar Name="message" Value="'[' ADD LTrim(' a b c d ') ADD ']'" />
<Echo ContentLinkId="viewmsg" />
</Out>
</Action>
示例輸出
[a b c d]
LTrim()LTRIM
刪除起始空格後返回字符表達式。
語法 LTRIM ( character_expression )
參數 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)
- 詞條統計
-
- 瀏覽次數:次
- 編輯次數:12次歷史版本
- 最近更新: 勤奋的CKY0821