We would like to know how to concat string with backspace.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
<!--from w w w . java2 s. co m-->
function RemoveBackspaces(str)
{
while (str.indexOf("\b") != -1)
{
str = str.replace(/.\x08/, "");
}
return str;
}
document.writeln(RemoveBackspaces("Hello\b\b\b\bi, World!"));
</script>
</head>
<body>
</body>
</html>
The code above is rendered as follows: