Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Insta360 Link 2 Pro e 2C Pro: le webcam 4K che ti seguono, anche con gimbal integrata
Insta360 Link 2 Pro e 2C Pro: le webcam 4K che ti seguono, anche con gimbal integrata
Le webcam Insta360 Link 2 Pro e Link 2C Pro sono una proposta di fascia alta per chi cerca qualità 4K e tracciamento automatico del soggetto senza ricorrere a configurazioni complesse. Entrambi i modelli condividono sensore, ottiche e funzionalità audio avanzate, differenziandosi per il sistema di tracciamento: gimbal a due assi sul modello Link 2 Pro, soluzione digitale sul 2C Pro
Motorola edge 70: lo smartphone ultrasottile che non rinuncia a batteria e concretezza
Motorola edge 70: lo smartphone ultrasottile che non rinuncia a batteria e concretezza
Motorola edge 70 porta il concetto di smartphone ultrasottile su un terreno più concreto e accessibile: abbina uno spessore sotto i 6 mm a una batteria di capacità relativamente elevata, un display pOLED da 6,7 pollici e un comparto fotografico triplo da 50 MP. Non punta ai record di potenza, ma si configura come alternativa più pragmatica rispetto ai modelli sottili più costosi di Samsung e Apple
Display, mini PC, periferiche e networking: le novità ASUS al CES 2026
Display, mini PC, periferiche e networking: le novità ASUS al CES 2026
Sono molte le novità che ASUS ha scelto di presentare al CES 2026 di Las Vegas, partendo da una gamma di soluzioni NUC con varie opzioni di processore passando sino agli schermi gaming con tecnologia OLED. Il tutto senza dimenticare le periferiche di input della gamma ROG e le soluzioni legate alla connettività domestica
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 22-07-2010, 09:37   #1
Giovanni Tavella
Member
 
Iscritto dal: Feb 2010
Messaggi: 31
[Java] Prendere numeri e "Sotto stringhe" da una stringa

Se ho una stringa String S="10 attaccanti, 11 palloni,13 difensori"

dove ogni "parola" o "numero"contenuto nella stringa è separata dal "numero o parola" successiva da diversi "spazi vuoti", ma so che la stringa è formata da un "numero" seguito da una "parola".

Esempio: String esempio="Gianni 18 marco 1 mario 2".

vorrei sapere se esiste qualche metodo per estrarre da una stringa , prima un
"numero" e poi "una parola" separati da uno spazio o più.


Spero di essere stato chiaro



cosi va bene secondo voi(?) :


LinkedList numeri=new LinkedList();

LinkedList parole=new LinkedList();

String Esempio="Gianni 18 marco 1 mario 2";

Scanner scanner = new Scanner(Esempio);

scanner.useDelimiter("cosa metto come delimitatore"); /cosa metto come delimitatore??

while(scanner.hasNext()) {

numeri.add(scanner.next());

parole.add(scanner.next());

}
__________________
-.-''

Ultima modifica di Giovanni Tavella : 22-07-2010 alle 11:36.
Giovanni Tavella è offline   Rispondi citando il messaggio o parte di esso
Old 22-07-2010, 09:45   #2
!fazz
Moderatore
 
L'Avatar di !fazz
 
Iscritto dal: Nov 2006
Messaggi: 21944
regex

Quote:
split

public String[] split(String regex,
int limit)

Splits this string around matches of the given regular expression.

The array returned by this method contains each substring of this string that is terminated by another substring that matches the given expression or is terminated by the end of the string. The substrings in the array are in the order in which they occur in this string. If the expression does not match any part of the input then the resulting array has just one element, namely this string.

The limit parameter controls the number of times the pattern is applied and therefore affects the length of the resulting array. If the limit n is greater than zero then the pattern will be applied at most n - 1 times, the array's length will be no greater than n, and the array's last entry will contain all input beyond the last matched delimiter. If n is non-positive then the pattern will be applied as many times as possible and the array can have any length. If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded.

The string "boo:and:foo", for example, yields the following results with these parameters:

Regex Limit Result
: 2 { "boo", "and:foo" }
: 5 { "boo", "and", "foo" }
: -2 { "boo", "and", "foo" }
o 5 { "b", "", ":and:f", "", "" }
o -2 { "b", "", ":and:f", "", "" }
o 0 { "b", "", ":and:f" }

An invocation of this method of the form str.split(regex, n) yields the same result as the expression

Pattern.compile(regex).split(str, n)

Parameters:
regex - the delimiting regular expression
limit - the result threshold, as described above
Returns:
the array of strings computed by splitting this string around matches of the given regular expression
Throws:
PatternSyntaxException - if the regular expression's syntax is invalid
Since:
1.4
See Also:
Pattern

__________________
"WS" (p280,cx750m,4790k+212evo,z97pro,4x8GB ddr3 1600c11,GTX760-DC2OC,MZ-7TE500, WD20EFRX)
Desktop (three hundred,650gq,3800x+nh-u14s ,x570 arous elite,2x16GB ddr4 3200c16, rx5600xt pulse P5 1TB)+NB: Lenovo p53 i7-9750H,64GB DDR4,2x1TB SSD, T1000
!fazz è offline   Rispondi citando il messaggio o parte di esso
Old 22-07-2010, 11:17   #3
Giovanni Tavella
Member
 
Iscritto dal: Feb 2010
Messaggi: 31
I no speak English

__________________
-.-''
Giovanni Tavella è offline   Rispondi citando il messaggio o parte di esso
Old 22-07-2010, 15:11   #4
!fazz
Moderatore
 
L'Avatar di !fazz
 
Iscritto dal: Nov 2006
Messaggi: 21944
Quote:
Originariamente inviato da Giovanni Tavella Guarda i messaggi
allora meglio che lo impari, almeno quello tecnico altrimenti nella programmazione non vai tanto avanti

cmq in parole povere la classe string ha il metodo split che permette di dividere una stringa in un insieme di stringhe (restituite in un array) secondo quanto definito nella regex passata come parametro

http://java.html.it/articoli/leggi/2...olari-in-java/
__________________
"WS" (p280,cx750m,4790k+212evo,z97pro,4x8GB ddr3 1600c11,GTX760-DC2OC,MZ-7TE500, WD20EFRX)
Desktop (three hundred,650gq,3800x+nh-u14s ,x570 arous elite,2x16GB ddr4 3200c16, rx5600xt pulse P5 1TB)+NB: Lenovo p53 i7-9750H,64GB DDR4,2x1TB SSD, T1000
!fazz è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Insta360 Link 2 Pro e 2C Pro: le webcam 4K che ti seguono, anche con gimbal integrata Insta360 Link 2 Pro e 2C Pro: le webcam 4K che t...
Motorola edge 70: lo smartphone ultrasottile che non rinuncia a batteria e concretezza Motorola edge 70: lo smartphone ultrasottile che...
Display, mini PC, periferiche e networking: le novità ASUS al CES 2026 Display, mini PC, periferiche e networking: le n...
Le novità ASUS per il 2026 nel settore dei PC desktop Le novità ASUS per il 2026 nel settore de...
Le novità MSI del 2026 per i videogiocatori Le novità MSI del 2026 per i videogiocato...
DAZN Full in versione mensile con 20 eur...
Samsung Galaxy S26: il top di gamma comp...
Intel Nova Lake: le iGPU dei nuovi proce...
ESA presenta ASTRIS, per rendere pi&ugra...
Ryanair non utilizzerà Starlink s...
Prince of Persia Remake potrebbe essere ...
Fujifilm annuncia la nuova stampante ist...
Arriva Red Hat Enterprise Linux for NVID...
Il marchio Volkswagen Jetta torna, ma or...
L'odio verso Electronic Arts è sp...
HONOR Magic 8 Pro: promosso da DXOMARK m...
instax mini Evo Cinema: la nuova soluzio...
YouTube mette un freno agli Shorts: i ge...
Dreame L40 Ultra AE di nuovo a 499€ su A...
I consigli per l'upgrade del proprio PC:...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 08:16.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Served by www3v