On Nov 17, 2006, at 10:08 AM, Lennox Jacob wrote:
Hello,
I have this in the MouseExit event of an EditField:
me.text = TitleCase(me.text)
It works for single names and a string of names
separated by a space.
How can I get it to work with a hyphenated name like:-
Wolf-Parkinson-White?
Basically by splitting the names apart, changing the title case and
putting it back together
Way #1
Change the - to something else (like chrB(10)) which will not be
in your text from the edit field
run title case n the resulting string
replace the chrb(10) with -
Note you can't use several of the other low ASCII characters like
0, 1, etc as TitleCase does not consider them as "word" separators
Way #2
Use Split to get an array of parts of the name
change the title case of each element of the resulting array
put it back together
Both should work with the name given as well as "james patrick wolf-
parkinson-white"
like this
dim input as string
dim s as string
dim s1(-1) as string
dim i as integer
input = "james patrick wolf-parkinson-white"
s = replaceall(input,"-",chrb(10))
s = Titlecase(s)
s = replaceall(s,chrb(10),"-")
statictext1.text = s
s = ""
s1 = split(input,"-")
for i = 0 to ubound(s1)
if s <> "" then s = s + "-"
s1(i) = Titlecase(s1(i))
s = s+s1(i)
next
statictext2.text = s
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>