ASP removes the function of consecutive carriage return and space at the beginning and end of a string.

Source: Internet
Author: User

'Remove the consecutive carriage return and space at the beginning and end of the string.
Function trimvbcrlf (STR)
Trimvbcrlf = rtrimvbcrlf (ltrimvbcrlf (STR ))
End Function

'Remove the consecutive carriage returns and spaces starting with a string.
Function ltrimvbcrlf (STR)
Dim POs, isblankchar
Pos = 1
Isblankchar = true
While isblankchar
If mid (STR, POs, 1) = "" then
Pos = POS + 1
Elseif mid (STR, POs, 2) = vbcrlf then
Pos = POS + 2
Else
Isblankchar = false
End if
Wend
Ltrimvbcrlf = right (STR, Len (STR)-pos + 1)
End Function

'Remove the consecutive carriage return and space at the end of the string.
Function rtrimvbcrlf (STR)
Dim POs, isblankchar
Pos = Len (STR)
Isblankchar = true
While isblankchar and Pos> = 2
If mid (STR, POs, 1) = "" then
Pos = pos-1
Elseif mid (STR, pos-1, 2) = vbcrlf then
Pos = pos-2
Else
Isblankchar = false
End if
Wend
Rtrimvbcrlf = rtrim (left (STR, POS ))
End Function

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.