Re: ucwords for mySQL?

From: Date: Sat, 19 Mar 2011 20:36:48 +0000
Subject: Re: ucwords for mySQL?
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-47728@lists.php.net to get a copy of this message
Try this, $String = strtolower($String); or $String = strtoupper($String) then plug into MySQL Best, Karl On Mar 19, 2011, at 1:21 PM, Oddity Software LLC wrote:
Need a custom function: BEGIN DECLARE c CHAR(1); DECLARE s VARCHAR(128); DECLARE i INT DEFAULT 1; DECLARE bool INT DEFAULT 1; DECLARE punct CHAR(17) DEFAULT ' ()[]{},.-_!@;:?/'; SET s = LCASE( str ); WHILE i < LENGTH( str ) DO
    BEGIN
      SET c = SUBSTRING( s, i, 1 );
      IF LOCATE( c, punct ) > 0 THEN
        SET bool = 1;
      ELSEIF bool=1 THEN
        BEGIN
          IF c >= 'a' AND c <= 'z' THEN
            BEGIN
              SET s = CONCAT(LEFT(s,i-1),UCASE(c),SUBSTRING(s,i+1));
              SET bool = 0;
            END;
          ELSEIF c >= '0' AND c <= '9' THEN
            SET bool = 0;
          END IF;
        END;
      END IF;
      SET i = i+1;
    END;
END WHILE; RETURN s; END Regards, Will T Chief Technical Officer Oddity Software LLC http://www.odditysoftware.com -----Original Message----- From: Ron Piggott [mailto:ron.piggott@actsministries.org] Sent: Saturday, March 19, 2011 1:05 PM To: php-db@lists.php.net Subject: [PHP-DB] ucwords for mySQL? I have found mySQL commands for LCASE and UCASE, but nothing equal to the PHP command “ucwords”. Is there a mysql command or will I need to use PHP to manipulate the strings? Ron The Verse of the Day “Encouragement from God’s Word” http://www.TheVerseOfTheDay.info -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Karl DeSaulniers Design Drumm http://designdrumm.com

« previous php.db (#47728) next »