Loading ...
Sorry, an error occurred while loading the content.

Re: [Clip] splitting a string on a character

Expand Messages
  • Alan
    Don Passenger wrote: [ . . ] ... Hugo has shared the equivalent: ^!SetListDelimiter : ^!SetArray my( @stuff ) = split( /:/,
    Message 1 of 4 , Oct 3, 2004
      Don Passenger wrote:
      [ . . ]
      > Perl has a split function that does this type of thing, but I am not
      > finding the equivalent.

      Hugo has shared the equivalent:

      ^!SetListDelimiter :


      my( @stuff ) = split( /:/, $SomeDataString ) ;

      But if your char also is a *Perl* meta char (for example, just such as
      the pipe or | char is) then such meta char need be escaped (\ escapes,
      makes so is interpreted as a literal), thus:

      my( @stuff ) = split( /\|/, $SomeDataString ) ;

      Perl split does use a character as a delimiter then all item(s) between
      delimiter(s) are split off so to speak (or, put into an array).


    Your message has been successfully submitted and would be delivered to recipients shortly.