help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help


From: Jesper Harder
Subject: Re: Help
Date: Thu, 24 Oct 2002 15:01:51 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-redhat-linux-gnu)

swk <sunwukong@hananet.net> writes:

> Each line starts with a modified ISO date    e.g.,   19991203   (YYYYMMDD)
>
> Is there any way to pull the ISO Dates to a file and then append the
> equivilant Chinese dates to a file?

I don't think there's any predefined functionality for that.  Here's a
suggestion for a way you could implement it.  

Evaluate the following, load the file with the ISO dates in a buffer and
do `M-x jh-iso-to-chinese', which will put the Chinese dates in another
buffer.


(defun jh-iso-to-chinese ()
  (interactive)
  (goto-char (point-min))
  (while (re-search-forward 
"^\\([[:digit:]]\\{4\\}\\)\\([[:digit:]]\\{2\\}\\)\\([[:digit:]]\\{2\\}\\)" nil 
t)
    (let ((str (format "%s\n" (calendar-chinese-date-string 
                               (mapcar 'string-to-int 
                                       (list (match-string 1) 
                                             (match-string 2) 
                                             (match-string 3)))))))
    (with-current-buffer (get-buffer-create "*chinese output*")
      (insert str))))
  (switch-to-buffer "*chinese output*"))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]