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
  • Select an option

  • Save marcosfreitas/af80df6783e151d683ca to your computer and use it in GitHub Desktop.

Select an option

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(value, my_array)
Dim i
inArray = false
For i=0 To Ubound(my_array)
If (my_array(i) = value) Then
inArray = i
Exit Function
End If
Next
End Function
ids_ignorados = Array("42","23","20","30","32","24","25","37","39","40","38")
find_this = "38"
If (inArray(find_this, ids_ignorados) ) Then
Response.Write findThis & " is in the array"
ElseIf (inArray(find_this, regex_colunas_ignoradas)) = false then
Response.Write findThis & " is not in the array"
Else
Response.Write "I don't know nothing"
End If
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment