exchange substr with split better functionlality and readiability