For YFS1 - Title Case

Discussion in 'PHP' started by dct, Sep 7, 2005.

  1. #1
    I remember a while ago YFS asking how to convert a string to title case (for Article Depot I assume). I've just come across the article Title Case in PHP which does exactly what it says on the tin.

    Maybe a bit late for YFS but could be useful to others wanting the same thing.
     
    dct, Sep 7, 2005 IP
    smindsrt and yfs1 like this.
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
  3. SEbasic

    SEbasic Peon

    Messages:
    6,317
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can do it in CSS too.
     
    SEbasic, Sep 7, 2005 IP
  4. dct

    dct Finder of cool gadgets

    Messages:
    3,132
    Likes Received:
    328
    Best Answers:
    0
    Trophy Points:
    230
    #4
    T0PS and SE do those ways take into account the short words like the, in, of etc and only capitalise them if they begin the title? If they do that will be a way easier way of doing things.
     
    dct, Sep 7, 2005 IP
  5. SEbasic

    SEbasic Peon

    Messages:
    6,317
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #5
    SEbasic, Sep 7, 2005 IP
  6. tresman

    tresman Well-Known Member

    Messages:
    235
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    138
    #6
    This was discussed in the thread and while it could be almost valid (words like in, the, a... didn't have to be capitalized), it only works "for the screen" (or whatever media you do the css sheet).

    I do like CSS, but on that case it was a matter of server side programming, as it needed to be stored on a database after doing the text transformation.
     
    tresman, Sep 7, 2005 IP
  7. SEbasic

    SEbasic Peon

    Messages:
    6,317
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Oh sorry - I misread the post....

    Yeah, CSS isn't that clever yet ;)
     
    SEbasic, Sep 7, 2005 IP
  8. yfs1

    yfs1 User Title Not Found

    Messages:
    13,798
    Likes Received:
    922
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I am going to mess around with the code DCT linked to although in the original thread I pretty much decided there were just too many exceptions.

    Things like iPod and eBay or when someone uses all capitals.

    Not to mention when "the" is the first word etc.

    I do appreciate the link though and I am going to try it.
     
    yfs1, Sep 7, 2005 IP
    smindsrt likes this.