Italian Estrapolare dati da file di testo con B4J

nonno

Active Member
Licensed User
Longtime User
Ciao a tutti,
chiedo se qualcuno potrebbe dirmi come potrei estrapolare dei dati da una stringa di testo, "uso B4J" i campi non hanno una dimensione definita, contengono numeri , lettere, spazzi. tipo ; "qwbvg,12334, ////////,asc,12,wwe"
i campi sono separati da virgola.
Ho visto un posto di qualche anno fà dove @luca ha risposto dando info. ma era per B4A.
 

Star-Dust

Expert
Licensed User
Longtime User
Con regex.

Prova tipo cosi
B4X:
Dim Stringhe() as string = Regex.Split(",",stringa)
Otterrai un array delle stringhe divise per la virgola. Funziona su tutte le piattaforme
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User

Star-Dust

Expert
Licensed User
Longtime User
Il codice funziona perfettamente.
Ho fatto questa prova:
B4X:
    Dim Stringhe() As String = Regex.Split(",","qwbvg,12334, ////////,asc,12,wwe")
    For Each S As String In Stringhe
        Log(S)
    Next

Risultato
Waiting for debugger to connect...
Program started.

qwbvg
12334
////////
asc
12
wwe
 
Top