Function overview
Prototype
NoSingleCharacters (
Text )
Parameters
Text The text from which single letter words are to be removed
Description
Tags:
Text Parsing Recursive Custom Function
This recursive function takes any text string and removes single alpha-numeric characters that are isolated by punctuation and spaces. In the process most punctuation is replaced with space characters. This can be useful when further parsing of the text would otherwise be complicated by single characters and punctuation.
Examples
Sample input
NoSingleCharacters(John_H_Smith@somewhere.net)
Sample output
John Smith somewhere net
Function code
Let (
[
FilterText = Substitute(Text;[".";" "];["-";" "];["_";" "];[",";" "];["@";" "];[";";" "];[":";" "]);
Iteration = WordCount(FilterText);
FirstWord = If(Length(LeftWords(FilterText;1))=1;"";LeftWords(FilterText;1) & " ");
RemainingList = RightWords (FilterText;Iteration-1)
];
FirstWord & Case(Iteration = 1 ;RemainingList;NoSingleCharacters(RemainingList) & " ")
)
// ===================================
/*
This function is published on FileMaker Custom Functions
to check for updates and provide feedback and bug reports
please visit http://www.fmfunctions.com/fid/236
Prototype: NoSingleCharacters( Text )
Function Author: Ken S. (http://www.fmfunctions.com/mid/223)
Last updated: 11 December 2009
Version: 1
*/
// ===================================
Let (__LITBR____LITBR__ [__LITBR__ FilterText = Substitute(Text;[".";" "];["-";" "];["_";" "];[",";" "];["@";" "];[";";" "];[":";" "]);__LITBR__ Iteration = WordCount(FilterText);__LITBR__ FirstWord = If(Length(LeftWords(FilterText;1))=1;"";LeftWords(FilterText;1) & " "); __LITBR__ RemainingList = RightWords (FilterText;Iteration-1)__LITBR____LITBR__ ];__LITBR__ __LITBR__ FirstWord & Case(Iteration = 1 ;RemainingList;NoSingleCharacters(RemainingList) & " ")__LITBR____LITBR____LITBR__ )__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/236__LITBR____LITBR__ Prototype: NoSingleCharacters( Text )__LITBR__ Function Author: Ken S. (http://www.fmfunctions.com/mid/223)__LITBR__ Last updated: 11 December 2009__LITBR__ Version: 1__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.