ASP removes the code of the last comma as a Null String

Source: Internet
Author: User

How to replace the last comma in ASP with a Null String
For example, AAA, BBB, CCC, eee.

How can I leave the last comma unchanged?
Example: AAA, BBB, CCC, eee.

How can I leave the last comma unchanged?
Aaa, BBB, CCC, and Eee are not modified.

CopyCode The Code is as follows: <%
STR = "AAA, BBB, CCC, eee ,"
If right (STR, 1) = "," then
STR = left (STR, Len (STR)-1)
End if
%>

The ASP right function returns a specified number of characters from the right of the string.

Tip: to determine the number of characters in the string parameter, use the Len function.

Tip: You can also refer to the left function.

Syntax
Right (string, length)

Parameter description
String
Required. String expression. the rightmost character is returned.
Length
Required. A numeric expression that specifies the number of characters to return. If the value is 0, a zero-length string is returned. If the value is greater than or equal to the number of all characters in the string parameter, the entire string is returned.

Instance 1Copy codeThe Code is as follows: dim txttxt = "this is a beautiful day! "
Response. Write (right (txt, 11 ))
Output: utiful day!

Instance 2Copy codeThe Code is as follows: dim txttxt = "this is a beautiful day! "
Response. Write (right (txt, 100 ))
Output: This is a beautiful day!

Instance 3Copy codeThe Code is as follows: dim txt, xtxt = "this is a beautiful day! "X = Len (txt)
Response. Write (right (txt, x ))
Output: This is a beautiful day!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.