Código fuente de 'MidReverse.asp'

<html>
<head>
<title>MidReverse - Códigos asp, programacion asp, descargas asp, rutinas asp</title>
</head>

<p align="center"><b><font size="3">MidReverse</font></b>
<body style="font-family: Arial; font-size: 11pt"></p>

<br>
La función <i>MidReverse</i> actúa como la función MID sólo que al revés.<br>
Funcionamiento: Dada una cadena, el número de comienzo dentro de esa cadena y la longitud <u>contando 
hacia el principio</u> (MID cuenta hacia el final), extrae subcadenas.<br>
<br>
<b>Ejemplo:</b><br>
MidReverse(&quot;Visual basic&quot;,12,5)=&quot;basic&quot;<br>
MidReverse(&quot;Visual basic&quot;,11,3)=&quot;asi&quot; 

<!--
'Copyright 2003 Squiver, Inc.®
    'Made By Adam Smith on Aug 15, 2003 for squiver.com
    'License: You are free to use this function as you please.
    'Function Descriptions:
    'MidReverse() - Same as Mid() Function only in Reverse...
-->
   
   <%
Function MidReverse(Data, Start, Length)

    'Get Total Characters-------
    Total_Char = Len(Data)
    '---------------------------
    
    'Check to see if Start is greater than total characters---------
    If Start > Total_Char Then Exit Function
    '---------------------------------------------------------------
    
    'Get a Reverse Starting point-------------
    Start = (Total_Char - Start) + 1
    '-----------------------------------------
    
    'Reverse Order String------------------
    For i = 1 To Total_Char
    Reverse_String = Mid(Data, i, 1) & Reverse_String
    Next
    '--------------------------------------

    'Reverse Order String------------------
    For ii = 1 To Total_Char
    
    If Start <= ii Then
    Reverse_String2 = Mid(Reverse_String, ii, 1) & Reverse_String2
    Counter = Counter + 1
    
    'Check to see if length has been reached----
    If Counter = Length Then
    Exit For
    End If
    '-------------------------------------------
    End If
    
    Next
    '--------------------------------------
    'Return Data---------------
    MidReverse = Reverse_String2
    '--------------------------

End Function

//response.write "<br>" & MidReverse("Visual basic",12,5) & "<br>"
//response.write MidReverse("Visual basic",11,3)& "<br>"

%>

</body></html>