Visualizzazione dei risultati da 1 a 3 su 3

Discussione: aiuto per funzione

  1. #1

    aiuto per funzione

    Se un carattere è presente nella stringa di input ma non in chars, allora è un carattere speciale.
    Il controllo termina e la funzione restituisce true.

    Quando la stringa restituisce true dovrebbe apparire a video carattere trovato invece non appare niente.

    qualcuno mi può aiutare


    Grazie



    public function hasSpecialchars(input)


    Dim chars
    Dim char
    Dim ii
    input="kgllggh%"
    chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW XYZ0123456789"

    for ii = 1 to Len(input)
    char = Mid(input, ii, 1)
    if(InStr(chars, char) = 0) then
    hasSpecialchars = true
    exit function
    end if
    next

    hasSpecialchars = false

    If hasSpecialchars= true Then
    Response.write "Trovato"
    Else
    Response.write "Non Trovato"
    End if

    end function

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
    public function hasSpecialchars(input) 
    
    
    Dim chars 
    Dim char 
    Dim ii 
    input="kgllggh%"
    chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" 
    hasSpecialchars = false   
    for ii = 1 to Len(input) 
    char = Mid(input, ii, 1) 
    if(InStr(chars, char) = 0) then 
    hasSpecialchars = true 
    exit for  
    end if 
    next 
    
    If hasSpecialchars= true Then
    Response.write "Trovato"
    Else 
    Response.write "Non Trovato"
    End if
    
    end function
    Roby

  3. #3
    mi sembra che se fai una ricerca trovi anche il corrispettivo in regexp

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.