Updated code to use indexOf to get '/' position. Thanks