Results 1 to 5 of 5

Thread: [RESOLVED] capitalize Letters?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    7

    Resolved [RESOLVED] capitalize Letters?

    PHP Code:
    $words="a sentence";
    echo 
    $words
    How would I make the start of every new word a capital letter?

    edit: found out, cant make post resolved.
    Last edited by rscape; Aug 3rd, 2007 at 10:26 PM.

  2. #2
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    Ubuntu Haters Club
    Posts
    405

    Re: [RESOLVED] capitalize Letters?

    It does help to post the resolution so that other people with your problem/question can have the knowledge to fix it also.

    PHP Code:
    $words strtoupper("a sentence"); 
    echo 
    $words
    » Twitter: @rudi_visser : Website: www.rudiv.se «

    If Apple fixes security flaws, they are heralded as proactive. If Microsoft fixes a security flaw, they finally got around to fixing their buggy OS.

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [RESOLVED] capitalize Letters?

    Rudi, that will convert the whole string to uppercase. To capitalise the first character of every word, use ucwords().


    rscape, Sorry, I forgot to mention this at the time, but I marked your thread as resolved for you. You should be able to do this in future from the Thread Tools menu. Let me know if you cannot.

  4. #4
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    Ubuntu Haters Club
    Posts
    405

    Re: [RESOLVED] capitalize Letters?

    Doh, I misread the question, sorry about that!

    If you're doing this on a sentence, capitalising the first letter of every word will not make it look 'correct', if that is what you're meaning to do. If it is, take a look into regular expression replaces.
    » Twitter: @rudi_visser : Website: www.rudiv.se «

    If Apple fixes security flaws, they are heralded as proactive. If Microsoft fixes a security flaw, they finally got around to fixing their buggy OS.

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [RESOLVED] capitalize Letters?

    There are some user-created examples of functions for sentence casing on the strings page of the PHP.net manual.
    http://php.net/manual/en/ref.strings

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width