Web Analytics Made Easy -
StatCounter stripping after certain position - CodingForum

Announcement

Collapse
No announcement yet.

stripping after certain position

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • stripping after certain position

    How to strip off everything in a string after the 5th whitespace ?

    For example:

    $string="1 2 3 4 5 6 7 8 9";

    should become:

    $string="1 2 3 4 5 "
    Msnemo.com - Free winks, emoticons, avatars, moods and lots more for msn and windows live messenger.

  • #2
    one possibility:

    Code:
    $string = "1 2 3 4 5 6 7 8 9";
    $string =~ s/^((\S+\s+){5}).*$/$1/;
    print $string;

    Comment

    Working...
    X