?
Solved

partial decapitalize

Posted on 2007-11-13
5
Medium Priority
?
518 Views
Last Modified: 2008-02-01
decapitalize non first letters:
eg. HI GUYS. HOW ARE       YOU -> Hi Guys. How Are       You
spacing "\t\r\n " should remain same

could do it myself, rushing to sleep
0
Comment
Question by:ed987
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 28

Expert Comment

by:gamebits
ID: 20277002
$string = "HI GUYS. HOW ARE       YOU ";

$string = ucfirst(strtolower($string));

print $string;
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20277003
$bar = "HI GUYS. HOW ARE YOU";
$bar = ucwords(strtolower($bar));
echo $bar;

hope this helps.
0
 
LVL 17

Expert Comment

by:nplib
ID: 20277007
$str = "HI GUYS. HOW ARE YOU";

$str = strtolower($str);

$str = ucwords($str);

echo $str;

//Output will be "Hi Guys. How Are You"
0
 
LVL 7

Author Comment

by:ed987
ID: 20277029
i asked for partial decapitalize, not partial capitalize
lowercase remains lowercase
HELLO guys - > Hello guys

0
 
LVL 20

Accepted Solution

by:
steelseth12 earned 2000 total points
ID: 20277068
Hmmmm ....
try this

$str = "HELLO guys. HOW ARE";


$str = preg_replace("/([A-Z]+)/e","ucwords(strtolower('\\1'))",$str);

print $str;
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question