Simple php question?

Discussion in 'PHP' started by crazyhorse, Jan 1, 2005.

  1. #1
    Is there some easy little phpcode that will tidy up, my text , which im parsing into a thread. Like starting a sentence with capitals, ending it with a dot, etc, changing colors in to one standard color.
     
    crazyhorse, Jan 1, 2005 IP
  2. xml

    xml Peon

    Messages:
    254
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This will capitalise first char and end in a dot if ! || ? || . are not the end char. This is basic code, u'd need to expand on it I am sure.

    $str = ucfirst($threadString);

    if (!in_array(substr($str, -1), array('.', '!', '?')) $str .= '.';
     
    xml, Jan 1, 2005 IP
  3. crazyhorse

    crazyhorse Peon

    Messages:
    1,137
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the answer.
     
    crazyhorse, Jan 2, 2005 IP