Uffo Uffo - 3 months ago 19
HTML Question

String search and split

So I have the following string

/home/design/Baie/Design-Interior-Baie-019.jpg


Now is there a way to search for the word
Baie
and get back a string like this:

/home/design/Baie/


I'm trying to build a breadcrumb

Answer
var abcd = "/home/design/Baie/Design-Interior-Baie-019.jpg"
//Search
var n = abcd.search("Baie");
//split provide sub string
var xyz = abcd.split('Design');

consol.log(xyz[0])

Or PHP

$abcd = "/home/design/Baie/Design-Interior-Baie-019.jpg";
$xyz = explode('Design', $abcd);
print_r($xyz)
Comments