Say I have two string; "fruit;mango;apple;banana"
and "animal;dog;cat;cow"
. What i want is a function to check the first word before 1st semi colon and then if its "fruit"
get the other 3 elements(without semi colon) and store it in an array called fruit
and if animal
take the elements and store is animal array
. I thought of using loop and chatAt()
but that code will be kinda messy.
So I want to know is there any function to separate a string with char?