Controls the length of the output string, which can distinguish Chinese and English (ASP)

Source: Internet
Author: User
Tags strlen trim
Strvalue ("rerequest Email notification registration Email if not entered", 26)
Here 26 refers to 26 English letters, that is, 13 Chinese characters
Function strlen (str)
Dim p_len
P_len = 0
Strlen = 0
If trim (str) <> "then
P_len = len (trim (str ))
For xx = 1 to p_len
If asc (mid (str, xx, 1) <0 then
Strlen = int (strlen) + 2
Strlen = int (strlen) + 1
End if
End if
End function
Function strvalue (str, lennum)
Dim p_num
Dim I
If strlen (str) <= lennum then
Strvalue = str
P_num = 0
X = 0
Do while not p_num> lennum-2
X = x + 1
If asc (mid (str, x, 1) <0 then
P_num = int (p_num) + 2
P_num = int (p_num) + 1
End if
Strvalue = left (trim (str), x )&"... "
End if
End function

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.