Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
Select your favorite languages :
  • Or search :

Idiom #259 Split on several separators

Build list parts consisting of substrings of input string s, separated by any of the characters ',' (comma), '-' (dash), '_' (underscore).

import "regexp"
re := regexp.MustCompile("[,\\-_]")
parts := re.Split(s, -1)
sysutils
parts := s.split([',','_','-']);
import re
parts = re.split('[,_\-]', s)
parts = s.split( Regexp.union(",", "-", "_") )
let parts: Vec<_> = s.split(&[',', '-', '_'][..]).collect();

New implementation...
programming-idioms.org