USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Dicas

  ASP - Active Server Page    (Miscelâneas)

Título da Dica:  Contador de palavras e letras
Postada em 3/10/2003 por ^HEAVY-METAL^            
<%
Dim strScriptName
Dim strInputText

strScriptName = Request.ServerVariables("URL")

strInputText = Request.Form("txtWordCount")

If strInputText = "" Then
strInputText = "Este texto é para a área de texto!"
Else
Response.Write "Escreveste :<br />" & vbCrLf
Response.Write "<pre><u>"
Response.Write Server.HTMLEncode(strInputText)
Response.Write "</u>
</pre>" & vbCrLf

Response.Write "<p>Contem " _
& GetWordCount(strInputText) _
& "
palavras e " _
& GetCharCount(strInputText) _
& "
caracteres.</p><br />" & vbCrLf
End If

Function GetWordCount(strInput)
Dim strTemp

strTemp = Replace(strInput, vbTab, " ")
strTemp = Replace(strTemp, vbCr, " ")
strTemp = Replace(strTemp, vbLf, " ")

strTemp = Trim(strTemp)

Do While InStr(1, strTemp, " ", 1) <> 0
strTemp = Replace(strTemp, " ", " ")
Loop

GetWordCount = UBound(Split(strTemp, " ", -1, 1)) + 1
End Function

Function GetCharCount(strInput)
GetCharCount = Len(strInputText)
End Function ' GetCharCount

%>
<p>Escreve um texto:</p>

<form action="<%= strScriptName %>" method="post">
<textarea name="txtWordCount" cols="40" rows="5"
><%= Server.HTMLEncode(strInputText) %></textarea>

<br />

<input type="submit">
</form>

T+,
 


CyberWEB Network Ltda.    © Copyright 2000-2024   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página