× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Well my convCase gives you:

Emil Sommarströmell

otherwhise I could in my own name ;-)

p convCase b export
d pi 65535a varying
d input 65535a const options(*varsize) varying
d toCase 1a const
d ccsId 10i 0 const options(*nopass)

d localInput s 65535a varying
d output s 65535a varying

d convertCase pr extproc('QlgConvertCase')
d controlBlock * value
d input * value
d output * value
d length 10i 0 const
d error like(qusec)

d controlBlock ds
d rqsType 10i 0 inz(1)
d rqsCcsid 10i 0 inz(0)
d rqsDir 10i 0 inz(0)
d reserved 10 inz(*allx'00')

d qusec ds
d qusbprv 10i 0 inz(%size(qusec))
d qusbavl 10i 0 inz(0)
d qusei 7
d 1
d msgdata 500

/free

localInput = input;

select;
when toCase = 'U'
or toCase = 'u';
rqsDir = 0;
when toCase = 'L'
or toCase = 'l';
rqsDir = 1;
other;
return localInput;
endsl;

if %parms >= 3;
rqsCcsId = ccsId;
else;
rqsCcsId = 0;
endif;

output = localInput;

convertCase(%addr(controlBlock)
:%addr(localInput)+2
:%addr(output)+2
:%len(localInput)
:qusec);

return output;
/end-free
p e


On Sat, Feb 11, 2012 at 7:58 PM, CRPence <CRPbottle@xxxxxxxxx> wrote:

FWiW: Unfortunately that algorithm would generally produce what is
typically considered "A Title Case" value instead of "aCamelCase" value;
plus has an unstated assumption that the input value must not be all
blanks nor an empty string. As others had provided similarly, that
algorithm also does not support making lowercase from an international
character set. Consider that the upper case name [the OP wants to
process names] "EMIL SOMMARSTRÖM" processed by that algorithm produces a
Title Case value with a Camel Case value for the second token, i.e. the
value "Emil SommarstrÖm", instead of producing the Title Case value
"Emil Sommarström".

Regards, Chuck

On 11-Feb-2012 06:37 , Emil Sommarström wrote:
More samples:)

ptoNameCase...
p b
d pi 200a varying
d name 200a value varying

d uc c 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
d lc c 'abcdefghijklmnopqrstuvwxyz'
d pos s 5u 0
/free

name = %xLate(uc:lc:%trim(name));
dou pos = 0;
pos += 1;
%subst(name:pos:1) = %xLate(lc:uc:%subst(name:pos:1));
pos = %scan(' ':name:pos);
endDo;
return name;

/end-free
p e

On Thu, Feb 9, 2012 at 2:58 AM, Shannon ODonnell wrote:
Thanks!

sjl on Wednesday, February 08, 2012 3:34 PM wrote:

Here is what I was going to suggest:

I would store the conversion information in a dictionary file as
pairs of data, with the "From" word in all caps. In order to
perform conversion, take a word from the string being converted
and convert the value to all caps, then CHAIN to the dictionary
file with the value in all caps.

If found, the "to" value would be returned in CamelCase format.

Sample Dictionary file DDS:

UNIQUE
R @XLAT
WORDFROM 60A
WORDTO 60A

K WORDFROM

Example data:
WORDFROM WORDTO
------------------ ------------
AGRIFINANCE AgriFinance

Matt wrote:
If it's the first item from sjl then I would just create a
dictionary of either upper or lower cased words and their mixed
case counter parts.



--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.