Re: Uppercase conversion
Posted in 1997
This is a multi-part message in MIME format. --------------717C155941C6 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit albertob@flash.net wrote: > > Hi, > I am new to Informix. Does anyone knows how to convert a field to > Uppercase the upshift command, as in let variable = upshift(variable) > or to make a query condition not case sensitive? The easiest method if you are creating an app and data is not yet present is to use upshift. (or downshift). However, this is not always desired or practical. Therefore, you could use a function like the one below after inputs and in constructs (though this is more work and commits the data to look like the updown format). Also, you can check the faq at www.iiug.org, where I believe there is yet another not-perfect-but-workable solution. Tim Following find an updown function in 4gl that may be useful for your purpose or other purposes: --------------717C155941C6 Content-Type: text/plain; charset=us-ascii; name="updown.4gl" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="updown.4gl" ######################################################################### # # # MASTERS SOFTWARE COMPANY # # # # PROPRIETARY DATA # # # # This document contains trade secret data which is the property of # # Masters Software Company, Timothy M. Hood. Information contained # # herein may not be used, copied or disclosed in whole or in part # # except for maintenance and development of Practice Master, also known # # as Legal Master. Any other use is in violation of the copyright held # # and maintained by Masters Software Company, Timothy M. Hood. # # # # This material is also copyrighted as an unpublished work under # # Sections 104 and 408 of Title 17 of the United States Code. # # Unauthorized use, copying or other reproduction, including the # # removal of this copyright notice is prohibited by law. # # # # Anyone posessing this document agrees to spontaneous inspection by # # the copyright owner(s) at any future date and time during the life of # # the copyright to verify this copyright notice is intact. # # # ######################################################################### ######################################################################### # # # MODULE: updown.4gl # # # # DESCRIPTION: # # # # This module contains the updown function. # # # # FUNCTIONS: # # # # Function Name Description Location # # ===================== ================================== ======== # # updown Upshifts and Downshifts a string internal # # to make it a correctly capitalized # # proper name. # # # # GLOBAL VARIABLES: # # # # n/a # # # # MODULE VARIABLES: # # # # n/a # # # # SCCS INFORMATION # # ~~~~~~~~~~~~~~~~ # # # # Module Name ..... %M% # # Version ......... %I% # # Last Update ..... %G% # # # ######################################################################### ######################################################################### # # # FUNCTION: updown # # # # DESCRIPTION: # # # # This function formats a string to look like a correctly capitalized # # proper noun. For example, "TIMOTHY M. HOOD" becomes "Timothy M. Hood" # # and "dR. joHN mcdOUGal" becomes "Dr. John McDougal". # # # # ARGUMENTS RECEIVED: # # # # str The string to be processed # # # # ARGUMENTS RETURNED: # # # # str The string that was processed # # # # LOCAL VARIABLES: # # # # see below # # # # TABLES: # # # # Name Access # # ================= ============================================ # # n/a # # # # EXTERNAL CALLS: # # # # Function Name Description Location # # ===================== ================================== ======== # # n/a # # # ######################################################################### ######################################################################### # # # This function takes a string and capitalizes the first char of each # # word, and downshifts all following characters. It does know about Mc # # (but not mac or st because of MacHine or StOp). # # # ######################################################################### FUNCTION updown(str) DEFINE ######################################################################### # # # str string to change # # chr character to work on # # x working number # # n working number # # flags 1 = upshift next char, 2 = last char was an # # upshifted M # # # ######################################################################### str CHAR (80), chr CHAR (1), x SMALLINT, n SMALLINT, flags CHAR (3) LET flags[1, 1] = "y" LET x = LENGTH(str) FOR n = 1 TO x LET chr = str[n, n] IF (chr >= "A" AND chr <= "Z") OR (chr >= "a" AND chr <= "z") THEN IF flags[1, 1] = "y" THEN LET chr = UPSHIFT(chr) LET flags[1, 1] = "n" ELSE LET chr = DOWNSHIFT(chr) ######################################################################### # # # Upshift next char if this char is a 'c' and last char was an # # upshifted "M" # # # ######################################################################### IF chr = "c" AND flags[2, 2] = "y" THEN LET flags[1, 1] = "y" END IF END IF ELSE LET flags[1, 1] = "y" END IF IF chr = "M" THEN LET flags[2, 2] = "y" ELSE