MidRev Function:
Same as Mid() Function but in reverse.
Description:
MidRev Function returns a specified number of characters from a string counting in reverse order.
Syntax:
string = MidRev(string)
Example:
<%
response.write MidRev("1234567890", 5, 3) '--- returns: 345
%>
ASP Source Code:
<%
Public Function MidRev(String, Start, Length) Dim iChar, RevString, RevString2, i, j, Counter iChar = Len(String) If Start > iChar Then Exit Function Start = (iChar - Start) + 1 For i = 1 To iChar RevString = Mid(String, i, 1) & RevString Next For j = 1 To iChar If Start <= j Then RevString2 = Mid(RevString, j, 1) & RevString2 Counter = Counter + 1 If Counter = Length Then Exit For End If Next MidRev = RevString2 End Function
%>
|