Visualizzazione dei risultati da 1 a 6 su 6
  1. #1

    recuperare i numeri di tel da un testo.

    io ho un testo peino zeppo di scritte e numeri di tel.
    es:
    hkhfjkdskjdhsadjdhj tel 05489755 jksdhjsq d l l lkj tel. 035/45488 hjdhsjd hsajhd jsadhjshd jsashdjs j tel:04554545 kjdjkqwdjqwh 321786321j3h2 3u2321j32 jk21 2jk3 h1jk1

    io vorrei recuperare solo :
    05489755
    03545488
    04554545

    ovvero i 3 numeri che ci sono dentro...
    qualche consiglio?

  2. #2
    codice:
    <%
    stringa = "hkhfjkdskjdhsadjdhj tel 05489755 jksdhjsq d l l lkj tel. 035/45488 hjdhsjd hsajhd jsadhjshd jsashdjs j tel:04554545 kjdjkqwdjqwh 321786321j3h2 3u2321j32 jk21 2jk3 h1jk1"
    stringa = replace(stringa,"/","")
    stringa = replace(stringa,"\","")
    stringa = replace(stringa,":"," ")
    elementiStringa = split(stringa)
    dim numeri()
    n = 0
    for i = 0 to uBound(elementiStringa)
      if isNumeric(elementiStringa(i)) then
      reDim preserve numeri(n)
      numeri(n) = elementiStringa(i)
      n = n + 1
      end if
    next
    
    for y = 0 to uBound(numeri)
    response.write numeri(y) & "
    "
    next
    %>

  3. #3
    *umanamente* come fai? ti basi su "tel" nelle sue varie forme? che succede se trovi un "tel a tizio" oppure "sono al tel con mamma", o "ti tel alle 18.00"?

  4. #4
    grazie per l'aiuto , ma c'è un problema...
    mi prende tutti i numeri che sono scritti staccati anche se prima non c'è scrito tel
    io vorrei solo i numeri in cui prima c'è scritto tel.
    Andrebbe bene anche se mi prende ti tel 19:00
    Dopo quelli nel caso li rifiltro...

  5. #5
    Originariamente inviato da kokkus
    grazie per l'aiuto , ma c'è un problema...
    mi prende tutti i numeri che sono scritti staccati anche se prima non c'è scrito tel
    io vorrei solo i numeri in cui prima c'è scritto tel.
    Andrebbe bene anche se mi prende ti tel 19:00
    Dopo quelli nel caso li rifiltro...
    codice:
    <%
    stringa = "hkhfjkdskjdhsadjdhj tel 05489755 jksdhjsq d l l lkj tel. 035/45488 hjdhsjd hsajhd jsadhjshd jsashdjs j tel:04554545 kjdjkqwdjqwh 321786321j3h2 3u2321j32 jk21 2jk3 h1jk1 tel"
    stringa = replace(stringa,"/","")
    stringa = replace(stringa,"\","")
    stringa = replace(stringa,":"," ")
    stringa = replace(stringa,".","")
    elementiStringa = split(stringa)
    dim numeri()
    n = 0
    for i = 0 to uBound(elementiStringa)
      if inStr(elementiStringa(i),"tel") > 0 and i < uBound(elementiStringa) then
      	if isNumeric(elementiStringa(i+1)) then
      	reDim preserve numeri(n)
      	numeri(n) = elementiStringa(i+1)
      	n = n + 1
      	end if
    	end if
    next
    
    for y = 0 to uBound(numeri)
    response.write numeri(y) & "
    "
    next
    %>

  6. #6
    1. splitti per "tel"
    2. ti passi l'array e strippi tutti i caratteri NON numerici


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 © 2026 vBulletin Solutions, Inc. All rights reserved.