From: Greg Hill <ghill@synergymicro.com>
Subject: Re: a function for string splitting
Date: Tue, 26 Nov 2002 12:03:36 -0800 [thread overview]
Message-ID: <p04310102ba0980c21f0f@[198.17.100.22]> (raw)
In-Reply-To: <15843.33347.536168.30597@localhost.localdomain>
At 5:16 PM +0300 11/26/02, Luis O. Silva wrote:
>Dear Emacs community,
>
>I'm writing a function for translating dates in the form of a
>string into Spanish and Russian. For example, you have:
>
>"Thu, 21 Nov 2002 16:05:50 -0600 (CST)"
>
>Within my function I used a `let' expression of the form:
>
>(let ((day (substring "Thu, 21 Nov 2002 16:05:50 -0600 (CST)" 0 3))
> (month (substring "Thu, 21 Nov 2002 16:05:50 -0600 (CST)" 8 11)))
> ...)
>
>All works fine provided that there isn't any date with
>one-digit day, i. e., "Fri, 8 Nov 2002 11:56:37 -0500 (CST)"
>
>My question is what function I could use for correctly
>splitting the string.
Luis,
Give something like this a try:
(let*
((split-date (split-string "Thu, 21 Nov 2002 16:05:50 -0600 (CST)" " "))
((day-of-week (elt split-date 0))
((day-of-month (elt split-date 1))
((month (elt split-date 2))
...)
Be sure to use let* instead of let, since let does not guarentee the
order of evaluation, and you always want split-date to be evaluated
first.
--Greg
next prev parent reply other threads:[~2002-11-26 20:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-26 14:16 a function for string splitting Luis O. Silva
2002-11-26 20:03 ` Greg Hill [this message]
[not found] <mailman.1038319044.17125.help-gnu-emacs@gnu.org>
2002-11-26 14:49 ` Lee Sau Dan
2002-11-26 19:59 ` Luis O. Silva
2002-11-26 15:56 ` Daniel Jensen
2002-11-26 20:25 ` Luis O. Silva
[not found] ` <mailman.1038341287.29557.help-gnu-emacs@gnu.org>
2002-11-28 14:14 ` Kai Großjohann
2002-11-28 18:21 ` Luis O. Silva
[not found] ` <mailman.1038506557.25888.help-gnu-emacs@gnu.org>
2002-11-28 18:30 ` Benjamin Lewis
2002-11-28 18:50 ` Kai Großjohann
2002-11-29 7:03 ` Luis O. Silva
-- strict thread matches above, loose matches on Subject: below --
2002-11-26 20:14 Greg Hill
2002-11-27 5:40 ` Luis O. Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='p04310102ba0980c21f0f@[198.17.100.22]' \
--to=ghill@synergymicro.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).