• ISO Region Codes

    From Lawrence D'Oliveiro@21:1/5 to All on Sun Feb 18 07:44:44 2024
    Here’s a simple function I wrote so you can type a country code like “nz”, select it, and have it converted to the corresponding symbol,
    e.g. “🇳🇿”.

    (defun convert-to-region-codes (beg end)
    "converts alphabetic characters in the selection to “region indicator symbols”."
    (interactive "*r")
    (unless (use-region-p)
    (ding)
    (keyboard-quit)
    ) ; unless
    (let
    (
    deactivate-mark
    (intext (delete-and-extract-region beg end))
    c
    )
    (dotimes (i (- end beg))
    (setq c (elt intext i))
    (cond
    ((and (>= c ?A) (<= c ?Z))
    (setq c (+ (- c ?A) #x1F1E6))
    )
    ((and (>= c ?a) (<= c ?z))
    (setq c (+ (- c ?a) #x1F1E6))
    )
    ) ; cond
    (insert-char c)
    ) ; dotimes
    ) ; let
    ) ; convert-to-region-codes

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)