Thursday, October 01, 2009

IsConsonant Function

I wrote this little function for a teammate the other day and could not decide if I should blog about it or not. It is a simple function that I any Visual FoxPro programmer could write. Prior to writing the function, I searched the web to see if someone else had already written it. I could not find anything so I decided to post it hoping that I will save someone else time in the future.


FUNCTION IsConsonant
* Purpose...: Returns .T. if the letter passed is a consonant.
* Author....: Toni M. Feltman
* Parameters: tcLetter, The letter to check.
* tlYIsVowel, When passed .T. the letter Y is considered a vowel.
* Returns...: Boolean
* Added.....: 09/29/2009
LPARAMETERS ;
tcLetter, ;
tlYIsVowel

LOCAL ;
lcVowelString AS Character, ;
llReturn AS Boolean

lcVowelString = IIF(tlYIsVowel, 'AEIOUY', 'AEIOU')
llReturn = ISALPHA(tcLetter) AND NOT UPPER(tcLetter)$lcVowelString
RETURN llReturn

ENDFUNC

Labels: , ,

0 Comments:

Post a Comment

<< Home