سؤال

Is there a /character to perform a delete action when parsed, much like how /b performs a backspace when parsed?

هل كانت مفيدة؟

المحلول

No, and there is no backspace either, in the sense implied in the question. The notation \b denotes the control character U+0008 BACKSPACE, which may have some effect on some devices but does not usually do anything on modern devices and in modern programs. (And /b is just two Ascii characters.)

You can see by testing with alert('FOO\bBAR'.length). It shows 7, since BACKSPACE is just one character there. It has no visible form, and it does not remove anything or make anything else invisible.

Other control characters are similarly ignored, except for characters related to line breaks and the HORIZONTAL TAB, which may have special effects when included in document content. Control characters were included in the Ascii code for use in various device control operations. Modern programming languages may still have escape notations for such characters, but this does not mean that they should be expected to have practical use nowadays.

نصائح أخرى

Yes, \b-but it only deletes itself when used in a string.

var s='tell me\b\b\bnow';
s

/*  returned value: (String)
tell menow
*/
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top