[PHP-DB] ucwords for mySQL?

2011-03-19 Thread Ron Piggott

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  


RE: [PHP-DB] ucwords for mySQL?

2011-03-19 Thread Oddity Software LLC
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.pigg...@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



Re: [PHP-DB] ucwords for mySQL?

2011-03-19 Thread Karl DeSaulniers

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.pigg...@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


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php