Typescript Remove Last Character From String To Binary