×
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.
On 11-Feb-2012 08:13 , Henrik Rützou wrote:
Or ....
var = 'SHANNON O''DONNELL';
ic = ' ';
for i = 1 to %len(var);
select;
when ic = ' '
or ic = '''';
other;
%subst(var:i:1) = convCase(%subst(var:i:1):'L');
endsl;
ic = %subst(var:i:1);
endfor;
dsp = var;
dsply dsp;
Returns:
Shannon O'Donnell
The algorithm might be a bit more efficient for generally longer name
strings if modified to instead, lower-case the entire string first and
then upper-case just the one character each time the previous character
was one of some chosen delimiters.? Adding a couple more delimiters
common in generic /name/ data might have the potential to improve the
output, depending on the actual name data used as input:
var = convCase(var:'L'); // lc the full string
pc = ' '; // force uc of first character
for i = 1 to %len(var);
select;
when pc = ' ' or pc = '''' or pc = ','
or pc = '.' or pc = '-'; // uc for these "prev char";
%subst(var:i:1) = convCase(%subst(var:i:1):'U');
other; // skip upper casing if prev char not one of above
endsl;
pc = %subst(var:i:1); // reset the "previous character"
endfor;
Input: DSPLY output: Maybe more desirable:
C.R.PENCE C.R.Pence N/A
SHANNON O'DONNELL Shannon O'Donnell N/A
UPPER-CASE Upper-Case N/A
EMIL SOMMARSTRÖM Emil Sommarström N/A
RUDOLF VON ÖSTERREICH Rudolf Von Österreich Rudolf von Österreich
MACARTHUR,ART US ARMY Macarthur,Art Us Army MacArthur,Art US Army
R.CAVELIER DE LA SALLE R.Cavelier De La Salle R.Cavelier de la Salle
Regards, Chuck
As an Amazon Associate we earn from qualifying purchases.