CoderZone.org

Category: >> Perl Code >> Create an array from comma separated items in a string Bookmark and Share

<< lastnext >>

Snippet Name: Create an array from comma separated items in a string

Description: The quotewords() function ignores separator characters inside double-quotes while splitting on those same characters outside of double-quotes.

Also see:
» SEO string generator
» Match all #RRGGBB or #RGB values i...
» Remove empty lines from a string o...
» Find first non-numeric character i...
» Read a web page directly in to a s...
» Multi-line variables and strings i...
» Convert a String to Title Case in ...
» Create an array from words in an H...
» Count all words in a string
» Count specific characters in a str...
» Randomize an array
» Removing duplicate array items whi...
» Get every 2nd (or 3rd, 4th, ...) e...
» Grab the last element of an array
» Create an array from the contents ...
» Create an array from the lines of ...
» Create an array from a range of le...
» Convert Unix time string to a date...
» Easy Numeric Array Sorting
» Handy In_Array() Just Like In PHP
» Count Uppercase Letters In A String
» Read GET URL Variables Into An Ass...
» Neatly trim a string to a set numb...
» Array of all US states
» Search array elements for a substr...
» Create a drop down menu from an ar...
» Add a period at the end of a strin...
» Count capital letters in a string
» Search All Words Of A String In my...

Comment: (none)

Author: CoderZone
Language: PERL
Highlight Mode: PERL
Last Modified: December 03rd, 2010

$_ = '"Rogers, Ted", "Marks, Jim", Terry';
use Text::ParseWords;
@names = quotewords(",", 0, $_);
print join(" &", @names);
 
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 7