Bob,
I have never been satisfied with MCT so I wrote my own, feel free to use what
you will and add your accented characters logic to it.
SUBROUTINE DAG.MCT(OUT.DATA, IN.DATA)
* MCT - Masked Character Title
* A better option than using UniBasic's MCT Conversion Code
* by David A. Green -- 5/20/02 -- www.dagconsulting.com
*
GOSUB INIT
BEGIN CASE
CASE IN.DATA = UPCASE(IN.DATA) ; GOSUB DO.MCT
CASE IN.DATA = DOWNCASE(IN.DATA) ; GOSUB DO.MCT
CASE 1 ; OUT.DATA = IN.DATA
END CASE
*
RETURN
!
INIT:
WORD.EXCEPTIONS = ""
WORD.EXCEPTIONS<1, -1> = "BY"
WORD.EXCEPTIONS<1, -1> = "IN"
WORD.EXCEPTIONS<1, -1> = "OF"
WORD.EXCEPTIONS<1, -1> = "AND"
WORD.EXCEPTIONS<1, -1> = "ON"
WORD.EXCEPTIONS<1, -1> = "THE"
*
WORD.BOUNDRYS = ""
WORD.BOUNDRYS := " "
WORD.BOUNDRYS := "-"
WORD.BOUNDRYS := "."
WORD.BOUNDRYS := "_"
WORD.BOUNDRYS := "&"
WORD.BOUNDRYS := "/"
WORD.BOUNDRYS := "("
WORD.BOUNDRYS := ")"
WORD.BOUNDRYS := @AM
WORD.BOUNDRYS := @VM
WORD.BOUNDRYS := @SM
WORD.BOUNDRYS := @TM
*
OUT.DATA = ""
RETURN
!
DO.MCT:
DATA.LEN = LEN(IN.DATA)
THIS.WORD = ""
FOR DATA.PTR = 1 TO DATA.LEN
DATA.CHAR = IN.DATA[DATA.PTR, 1]
BEGIN CASE
CASE INDEX(WORD.BOUNDRYS, DATA.CHAR, 1) ; GOSUB DO.THIS.WORD
CASE 1 ; THIS.WORD := DATA.CHAR
END CASE
NEXT DATA.PTR
DATA.CHAR = ""
GOSUB DO.THIS.WORD
RETURN
!
DO.THIS.WORD:
IF THIS.WORD THEN
BEGIN CASE
CASE THIS.WORD[1, 3] = "MCC" ; THIS.WORD =
OCONV(THIS.WORD[1,2], "MCT"):OCONV(THIS.WORD[3,9999], "MCT")
CASE OUT.DATA = "" ; THIS.WORD =
OCONV(THIS.WORD, "MCT")
CASE THIS.WORD MATCHES WORD.EXCEPTIONS ; THIS.WORD =
OCONV(THIS.WORD, "MCL") ;* Lower Case
CASE 1 ; THIS.WORD =
OCONV(THIS.WORD, "MCT") ;* Title Case
END CASE
OUT.DATA := THIS.WORD:DATA.CHAR
THIS.WORD = ""
END ELSE
OUT.DATA := DATA.CHAR
END
RETURN
!
END
David A. Green
(480) 201-7953
DAG Consulting
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Bob Little
Sent: Monday, November 25, 2013 1:10 PM
To: U2 Users List [[email protected]]
Subject: [U2] Working with accented characters
To convert the first character of a regular ASCII string to uppercase, I'd use
OCONV("STRING",'MCT') so that "STRING" is output as "String". However, this
doesn't seem to work for Spanish accented characters. The machine is UV
11.1.11 with NLS enabled.
What is the most elegant way to convert a name, such as JOSÉ to José ? I'm not
a sys admin, so if it requires setting up an NLS map or something along those
lines, I'm probably out of luck.
bob little
applications architect
independent contractor
market america, inc.
1302 pleasant ridge rd.
greensboro, nc 27409
Phone: 336-698-4367
Cell: 248-675-5515
Skype: boblittle904
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users