FoxPro Tutorial & Source Code
* Author : Team of Pelagian Softwares * Date : 24/03/2007 * Source : sh_str.prg * Description : Function to Make Short Name of Person
set talk off accept "enter your full name: " to fullName
smName = abrv(fullname)
?"Full Name: " ?fullName ? ?"Short Name:" ?smname
* Paste This Function in Your program file * call this function for variable/field boths
FUNCTION abrv PARA _fl _fl = _fl + " " l=len(_fl) y=0 _sh=UPPER(left(_fl,1)+".") do whil y if subs(_fl,y,1)=" " _sh=_sh+UPPER(subs(_fl,y+1,1)+". ") else endI y=y+1 endD
_fl=alltrim(_fl) l=len(_fl) y=len(_fl) _sr="" do whil !y=0 if subs(_fl,y,1)=" " exit else _sr=UPPER(subs(_fl,y,1))+_sr endI y=y-1 endD x=len(alltrim(_sh)) _sh=LEFT(ALLTRIM(_sh),x-2)+ALLTRIM(_sr)
REturn ; (PADR(_sh,l-1))
Also download:
|
|