how to split string and store them into different variable

sir actually i am trying to split string and store them into different variable. but i am not getting how to do. i referred many forum i got idea but not able split and store when lenght of variable changes. i want to split this string for home/kitchen/light or sometime home/fan depends on what address will be provided by firebase.