alex-009
alex-00913mo ago

Is there a split_to_array function like join_to_string

I need to split a string with some delimiter =[, and ask my self if there is something in deno which i can use for this. https://deno.land/std@0.205.0/collections/join_to_string.ts
2 Replies
king8fisher
king8fisher13mo ago
Is this what you are looking for?
const str = "How is $everything g$oing?"
const breakpoint = /\$e|\$o/
const splitted = str.split(breakpoint)
// [ 'How is ', 'verything g', 'ing?' ]
const str = "How is $everything g$oing?"
const breakpoint = /\$e|\$o/
const splitted = str.split(breakpoint)
// [ 'How is ', 'verything g', 'ing?' ]
marvinh.
marvinh.13mo ago
adding for completeness: Splitting strings is part of the JavaScript language itself and doesn't require additional libraries. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split