LIST Please forgive if you get this twice but it got bounced back undelivered 
and doesn't seem to have got through

Philippe

I've knocked up the following function that should do the job.
I've paper tested it but not as an mbx.
Note that it only caters for hyphenated place names or those that comprise just 
one word.
If you want it to cater for names with spaces in, e.g. "MONT BLANC" then you'll 
need to add a similar test for SPACE.
Note also that it won't make a special case of words that don't need to be 
"propered", e.g. "de" or "of".  I've noticed in the past, when doing similar 
for names, such as MacDonald, McDonald, Mcdonald, Macdonald, it's very 
difficult to write a hard-and-fast rule.  You may have to hard-code special 
cases, such as "-DE-".

HTH

Terry McDonnell

'_______________________________________________
Function        PROPER_PLACE( tcPlaceName as String)
'_______________________
Dim     lnStrLen, lnHyphPos, lnStartPos,        as SmallInt,
        llStringDone                            as Logical,
        lcSubStr, lcNamePart, lcPropPlace       as String

llStringDone    = FALSE
lnStartPos              = 1
lcPropPlace             = ""

Do while not llStringDone
  lnHyphPos                             = InStr( lnStartPos, tcPlaceName, "-")
  If lnHyphPos = 0 then                 ' no (more) hyphen(s) in place name
          llStringDone          = TRUE
  Else
          lnStrLen                      = lnHyphPos - lnStartPos
          lcSubStr                      = Mid$( tcPlaceName, lnStartPos, 
lnStrLen)
          If lcPropPlace <> "" then     ' i.e. not 1st section
                  lcPropPlace   = lcPropPlace + "-"
          End If
          lcPropPlace           = lcPropPlace + Proper&( lcSubStr)
          lnStartPos            = lnStartPos + lnStrLen + 1
  End If
Loop

PROPER_PLACE    = lcPropPlace

End Func 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Solomon Côté
Sent: 18 January 2006 21:31
To: Terry McDonnell
Subject: [MI-L] Reformatting character field

Hi,

 

I would like to reformat city names that are capitalized such as: 
SAINT-GEORGES-DE-CACOUNA into a proper format such as: Saint-Georges-de-Cacouna.

 

When using the function Proper$ in an update statement, I get: 
Saint-georges-de-cacouna, which is not good to me.

 

I tried using the MapInfo's Search and Replace tool for adding a space 
character after each "-", but this tool seems to only find the first appearance 
of "-" and I get this result : SAINT- GEORGES-DE-CACOUNA

If I could have SAINT- GEORGES- DE- CACOUNA, I would be able to use the Proper$ 
function effectively.

 

Does anyone know a tool or a function I could use to solve this problem?

 

Thanks a lot.

 

Kind regards,

__________________________________

 


Philippe Solomon Côté


MSc Geography

Consultant

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

 

KOREM inc.

www.korem.com <http://www.korem.com/> 

                   

MapInfo Québec, opéré par KOREM inc.

www.mapinfo.qc.ca <http://www.mapinfo.qc.ca/> 

__________________________________

 

680, boul. Charest Est, bureau 120

Québec (Québec)  G1K 3J4

Canada

Tél. : (418) 647-1555

Téléc. : (418) 647-1666 

Sans frais : 1 888 440-1MAP

Localisation : Québec 
<http://www.mapanswer.com/07_localisation/LocalisationDemoNav.jsp?profile=canada&userlinearunit=km&civicNumber=680&street=charest+est&city=quebec&code=G1K+3J4&province=qc>
   Montréal 
<http://www.mapanswer.com/07_localisation/LocalisationDemoNav.jsp?profile=canada&userlinearunit=km&civicNumber=1010&street=Sherbrooke+Ouest&city=Montr%25E9al&code=H3A+2R7+&province=qc>
 

__________________________________

 

_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l




_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to