#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    13
    Rep Power
    0
    how do seperate a string? if someone enters the string "discussion forum" i want to seperate the string into 2 seperate strings, "discussion" and "forum". how do you do this?

    thanks again
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    18
    You can use the explode() function to seperate strings on simple delimiters.

    $split=explode(" ","discussion forum");

    would create the array $split where
    $split[0]=="discussion" and
    $split[1]=="forum"

    you can define any delimiter you want as the first argument.
  4. #3
  5. Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    5
    Rep Power
    0
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by rod k:
    You can use the explode() function to seperate strings on simple delimiters.

    $split=explode(" ","discussion forum");

    would create the array $split where
    $split[0]=="discussion" and
    $split[1]=="forum"

    you can define any delimiter you want as the first argument.
    [/quote]

    May I continue this question..?
    if I want to seperate discussion => dis cussion
    how could I do ..?

    I had try the regex by php4

    like this ...

    //http://www.php.net/manual/function.preg-replace.php3
    //
    Note: This modifier was added in PHP 4.0.


    Example 1. Replacing several values

    $patterns = array("/(19|20d{2})-(d{1,2})-(d{1,2})/", "/^s*{(w+)}s*=/");
    $replace = array("3/4/1", "$1 =");
    print preg_replace($patterns, $replace, "{startDate} = 1999-5-27");


    This example will produce:

    $startDate = 5/27/1999

    Would you like to tell me ?

Similar Threads

  1. array explode ( string separator, string string [, int limit])
    By beemee_freeserv in forum HTML Programming
    Replies: 4
    Last Post: February 5th, 2004, 10:56 AM
  2. mgetty+sendfax on RH9
    By ayrin in forum Linux Help
    Replies: 0
    Last Post: January 31st, 2004, 02:11 AM
  3. Problems with my first DLL
    By lloydie-t in forum Delphi Programming
    Replies: 2
    Last Post: December 7th, 2003, 01:48 PM
  4. Advice on reversing order of characters within a string?
    By FriscoKid in forum C Programming
    Replies: 5
    Last Post: November 13th, 2003, 08:13 AM
  5. error in returned object
    By davidl in forum Java Help
    Replies: 6
    Last Post: October 9th, 2003, 04:34 PM

IMN logo majestic logo threadwatch logo seochat tools logo