GetWords ( text ; string )
Moderatore: Moderatori
-
- Messaggi: 3616
- Iscritto il: sabato 7 febbraio 2004, 1:00
- Località: Roma
- Contatta:
GetWords ( text ; string )
Quest'altra, invece, restituisce tutte le parole di un testo generico che contengono una data stringa.
Ad esempio:
GetWords("sopra la panca la capra canta";"pr") restituisce:
sopra
capra
Ad esempio:
GetWords("sopra la panca la capra canta";"pr") restituisce:
sopra
capra
Codice: Seleziona tutto
/*
Author
Daniele Raybaudi
modified 09/13/2005
*/
Consenti([
adjustedText = CercaeSost ( text ;
["¶";" "];
[",";" "];
[".";" "];
[":";" "];
[";";" "];
["!";" "];
["?";" "];
["\"";" "];
["(";" "];
[")";" "];
["%";" "];
["/";" "];
["*";" "];
["-";" "];
["[";" "];
["]";" "];
["'";" "];
["£";" "];
["$";" "];
["&";" "];
["=";" "];
["^";" "];
["+";" "];
["§";" "];
["°";" "];
["#";" "];
["_";" "];
["<";" "];
[">";" "];
["\\";" "]);
count = ContaRicorrenze ( adjustedText ; string );
len = Lunghezza ( adjustedText );
pos = Posizione ( adjustedText ; string ; 1 ; 1 );
startWord = Posizione ( adjustedText ; " " ; pos ; -1 ) + 1;
endWord = If ( Posizione ( adjustedText ; " " ; pos ; 1 ) ≠ 0 ; Posizione ( adjustedText ; " " ; pos ; 1 ) ; len + 1 );
word = Mezzo ( adjustedText ; startWord ; endWord - startWord );
nextText = Mezzo (adjustedText ; endWord + 1 ; len )
];
Casi(
count ; word & "¶" & GetWords ( nextText;string );
""
)
)
Raybaudi FMP 12 Adv. Windows XP SP3