Asp article paging code

Source: Internet
Author: User

'*************************************** *************
'Function name: StrLen
'Usage: get the string length (2 Chinese characters)
'Parameter: str ---- string content
'Return value: string length
'*************************************** *************

Function StrLen (Str)
Set rep = New regexp
Rep. Global = True
Rep. IgnoreCase = True
Rep. Pattern = "[^ \ x00-\ xff]"
StrLen = Len (Str) + rep. Execute (Str). Count
Set Rep = Nothing
End Function

'*************************************** *************
'Function name: StrLeft
'Usage: get a specified number of strings from the left (Chinese character: 2)
'Parameter: L ---- Number of characters
'Return value: string
'*************************************** *************

Function Strleft (Str, L)
Dim I, Test_Str, lens, tStr, nStr, tL
TStr = Left (Str,-Int (-(L/2 )))
NStr = Right (Str, Len (Str)-Len (tStr ))
If Len (nStr)> 0 Then tL = L-StrLen (tStr)
If Asc (Left (tStr, 1) <0 And Len (tStr) = 1 And L <2 Then tStr = ""
If tL> = 1 Then
Strleft = tStr & Strleft (nStr, tL)
Else
Strleft = tStr
End If
End Function

'*************************************** *************
'Function name: StrRight
'Usage: Get the specified number of strings (2 Chinese characters) from the right)
'Parameter: L ---- Number of characters
'Return value: string
'*************************************** *************

Function StrRight (Str, L)
Dim I, Test_Str, lens, tStr, nStr, tL
TStr = Right (Str,-Int (-(L/2 )))
NStr = Left (Str, Len (Str)-Len (tStr ))
If Len (nStr)> 0 Then tL = L-StrLen (tStr)
If Asc (Left (tStr, 1) <0 And Len (tStr) = 1 And L <2 Then tStr = ""
If tL> = 1 Then
StrRight = StrRight (nStr, tL) & tStr
Else
StrRight = tStr
End If
End Function

'*************************************** *************
'Function name: StrMid
'Usage: specify the start position to obtain the specified number of strings (2 Chinese characters)
'Parameter: the number of S-start strings, and the number of L-characters
'Return value: string
'*************************************** *************

Function StrMid (Str, S, L)
StrMid = strleft (Right (Str, Str Len (Str)-Len (strleft (Str, s) + 1), L)
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.