Text Case Conversion - UPPER_CASE

Here's an output conversion, posted a while ago on the OpenInsight discussion board, that converts a string to either all upper case, initial capitalization (using Namecap()), or mixed case (using MixedCase()). Note the use of the BRANCH argument to implement the appropriate conversion.

Calling this conversion in BASIC+ is as follows:

namecapped = iconv("iRa kRakOW", '[UPPER_CASE,NAMECAP]')

mixedcased = iconv("iRa kRakOW", '[UPPER_CASE,MIXEDCASE]')

uppercased = iconv("iRa kRakOW", '[UPPER_CASE]')

Note: This conversion can be used to convert text from lower case to upper case in an edit table, or any other window control that allows text input. The edit table control does not have a check box for upper case conversion.

The conversion subroutine is below:

COMPILE SUBROUTINE UPPER_CASE(CHARSTR CONV, CHARSTR ANS, CHARSTR BRANCH, CHARSTR RETURN_DATA)

declare function unassigned, namecap, mixedcase

*

* UPPER_CASE is a custom ICONV/OCONV procedure

* If called with 'NAMECAP', does initial capitalization.

* with no BRANCH converts entire string to uppercase.

*

* It should be placed in square brackets when called: [UPPER_CASE]

*

* 12/03/1997 * Dragos David Pociu

* 02/16/2003 * Ira Krakow - Modified to include branches for NameCap, MixedCase, and  UpperCase conversions

* Local Equates

EQU VALID$ TO 0 ;* Successful

if unassigned(BRANCH) then BRANCH =%%''%% 

* Begin Conversion

*

RETURN_DATA = ""

IF ANS NE "" THEN

  text = ANS

  ANS = ""

  STATUS() = VALID$

  begin case

     case branch =%%''%%   

       convert @LOWER_CASE to @UPPER_CASE in text

     case branch = 'NAMECAP'

       text = namecap(text)

     case branch = 'MIXEDCASE'

       text = mixedcase(text)

  end case

  return_data = text

END

return 0