× 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.



Rory,
That is what I am looking for.
A method to convert a text string from all upper case to a string where the first letter of each word is upper case and all others are lower case.
The words are separated by a blank.

It looks like your example will do what I want.

Thanks,
 
Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2 
IBM  Certified Specialist- e(logo) server i5Series Technical Solutions Designer V5R3
IBM  Certified Specialist- e(logo)server i5Series Technical Solutions Implementer V5R3
  
 






________________________________
From: Rory Hewitt <roryhewitt@xxxxxxxxx>
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Sent: Friday, April 10, 2009 4:24:53 PM
Subject: Re: Drop Case API

I assumed Jeff meant "1st-letter-upper-otherwise-lower". Hence the casing of
his question:

Is there an API or sample code for converting a text string from UPPER
CASE to Drop Case?

Any, the quick answer is that there isn't a single API. However, you could
do something like this (untested):

string = %xlate( UpperChars : LowerChars : string );
ConvertToUpper = *off;
for x = 1 to %len( string );
  char = %subst( string : x : 1 );
  if ConvertToUpper = *on and char <> ' ';
    string = %xlate( LowerChars : UpperChars : char );
    %subst( string : x : 1 ) = char;
    ConvertToUpper = *off;
  else;
    if char = ' ';                    <=======
      ConvertToUpper = *on;
    endif;
  endif;
endfor;

Although maybe you only want to capitalize the first letter in a sentence,
so you'd use this at <=======:

    if char = '.' and %subst( string : x + 1 : 1 ) = ' ';

although that would throw an error if the last character in the string is a
period. Plus you'd be better off basing char on a pointer, to avoid all
those silly substrings back and forth.

And maybe I was wrong about what Jeff wanted anyway.

Rory

On Fri, Apr 10, 2009 at 1:04 PM, Alan Shore <AlanShore@xxxxxxxx> wrote:


What is "Drop Case"?
Is it another name for lower case?

Alan Shore

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.