GetWords ( text ; string )

E' l'area in cui è possibile condividere funzioni personalizzate nate dalla creatività e l'esperienza degli sviluppatori FileMaker

Moderatore: Moderatori

Rispondi
raybaudi
Messaggi: 3616
Iscritto il: sabato 7 febbraio 2004, 1:00
Località: Roma
Contatta:

GetWords ( text ; string )

Messaggio da raybaudi » domenica 11 settembre 2005, 23:20

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

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

Rispondi