GNU Emacs Lisp Reference Manual
The following functions replace characters within a specified region based on their character codes.
If noundo is non-nil, then subst-char-in-region does not record the change for undo and does not mark the buffer as modified. This feature is used for controlling selective display (see Selective Display).
subst-char-in-region does not move point and returns nil.
---------- Buffer: foo ----------
This is the contents of the buffer before.
---------- Buffer: foo ----------
(subst-char-in-region 1 20 ?i ?X)
=> nil
---------- Buffer: foo ----------
ThXs Xs the contents of the buffer before.
---------- Buffer: foo ----------
The translation table table is a string; (aref table ochar) gives the translated character corresponding to ochar. If the length of table is less than 256, any characters with codes larger than the length of table are not altered by the translation.
The return value of translate-region is the number of characters that were actually changed by the translation. This does not count characters that were mapped into themselves in the translation table.