Fixed StringCut function which cuts all redundant bytes in a string