Skip to content

Instantly share code, notes, and snippets.

@marcosfreitas
Forked from gwobcke/checkIfInArray.asp
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcosfreitas/af80df6783e151d683ca to your computer and use it in GitHub Desktop.
Save marcosfreitas/af80df6783e151d683ca to your computer and use it in GitHub Desktop.
Esta função em ASP serve para verificar se um determinado valog existe em um array. Retorna false se não encontrar nada ou retorna a posição (i) onde o valor foi encontrado
<%
Function inArray(byVal value, byVal my_array)
Dim i
inArray = false
For i=0 To Ubound(my_array)
If (my_array(i) = value) Then
inArray = true
Exit Function
End If
Next
End Function
ids_ignorados = Array("42","23","20","30","32","24","25","37","39","40","38")
find_this = "32"
If (inArray(find_this, ids_ignorados)) Then
Response.Write findThis & " is in the array"
ElseIf (not inArray(find_this, regex_colunas_ignoradas)) then
Response.Write findThis & " is not in the array"
End If
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment