it will not work if your string is not null terminated