Re: CONTAINS() fails to recognize more than one "find" word
All,
Thanks for your suggestions/insights. I have almost replicated the functionality of Microsoft Outlook's Contact name parsing, but now notice a small glitch in Alpha's word() function.
Why does Alpha drop the period in a string? I would think that words would be separated by spaces only.
The reason why the . period appears correctly in the middle name is that the middle name is the residual string.
Alpha is having difficulty getting the period right anytime the word() function is used.
A sample database of names with a form with a button to perform parsing is attached.
Bob McGaffic
Pittsburgh, PA
All,
Thanks for your suggestions/insights. I have almost replicated the functionality of Microsoft Outlook's Contact name parsing, but now notice a small glitch in Alpha's word() function.
Why does Alpha drop the period in a string? I would think that words would be separated by spaces only.
Code:
Henry A. Apple, Sr., PhD parses to First name: Henry Middle name: A. Last name; Apple Pedigree: Sr Degree: PhD The pedigree should be Sr. not Sr
Code:
P. T. Barnum parses to First name: P Middle name: T. Last name: Barnum The first name should be P. not P
Alpha is having difficulty getting the period right anytime the word() function is used.
Code:
mString = "" mFirst_Name = "" mMiddle_Name = "" mLast_Name = "" mPedigree = "" mDegree = "" mString = topparent.full_name mDegree = word(mString,-1,",") mString = word(mString,1,",") IF CONTAINS(mString, "Jr.") .OR. CONTAINS(mString, "Sr.") .OR. CONTAINS(mString, "III") .OR. CONTAINS(mString, "IV") mPedigree = word(mString,-1) msgbox(mPedigree) mString = word_subtract(mString,mPedigree) END IF mString = word_subtract(mString,mPedigree) mLast_Name = word(mString,-1) mString = word_subtract(mString, mLast_name) mFirst_Name = word(mString,1) mString = word_subtract(mString, mFirst_Name) mMiddle_Name = mString IF mdegree = topparent.full_name mdegree = "" END IF parentform:First_Name.value = mFirst_Name parentform:Middle_Name.value = mMiddle_Name parentform:Last_Name.value = mLast_Name parentform:Name_Pedigree.value = mPedigree parentform:Name_Degree.value = ltrim(mDegree)
Bob McGaffic
Pittsburgh, PA
Comment