Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


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

[Javascript] Q on parsing


  • From: javascript@xxxxxxxxxx (Walter Torres)
  • Subject: [Javascript] Q on parsing
  • Date: Tue, 23 Jul 2002 18:51:16 -0700

This is a multi-part message in MIME format.

------=_NextPart_000_0020_01C23279.EDA26630
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

I am trying to keep to the standard on how to deal with date parsing...,


http://java.sun.com/products/jdk/1.1/docs/api/java.text.SimpleDateFormat.htm
l

The Java specs follow the 'C' specs

Walter

  -----Original Message-----
  From: javascript-admin@xxxxxxxxxx [mailto:javascript-admin@xxxxxxxxxx]On
Behalf Of Chris Berry
  Sent: Tuesday, July 23, 2002 6:34 PM
  To: javascript@xxxxxxxxxx
  Subject: Re: [Javascript] Q on parsing


      Just a quick thought, don't you have to use the escape character \ for
that?

  Chris Berry

  compjma@xxxxxxxxxxx
  Systems Administrator
  JM Associates

  "Ask me for the impossible and I'll do it immediately, miracles take a
little longer."
  >From: Walter Torres
  >Reply-To: javascript@xxxxxxxxxx
  >To: Walter Torres
  >CC: ,
  >Subject: [Javascript] Q on parsing
  >Date: Tue, 23 Jul 2002 20:18:30 -0500 (CDT)
  >
  >I am 99% complete on a date format parser.
  >
  >(will post when this question is answerd!)
  >
  >The last item is how to parse out a substring bracketed by single quotes.
  >
  >i.e.:
  >
  >I have this var...
  >
  > var format = "EEEE, MMMM dd, yyyy ''G'' 'at' hh:mm:ss a z" ;
  >
  >I can walk down this string and pull out "tokens" (same character of 1 or
  >more in length: ex: EEEE, hh, z )
  >
  >I do it like this...
  >
  > while ( i < intFormatLen )
  > {
  > var token = "";
  >
  > curChar = strFormat.charAt(i);
  >
  > while (( strFormat.charAt(i) == curChar ) && ( i < intFormatLen ))
  > token += strFormat.charAt(i++);
  >
  > result += formatOptions ( token );
  > }
  >
  >
  >Now, a double single quote (2 in a row) needs to be grapped and passed on
  >as a single token. but not 3 in a row, the third should be part of the
  >next token. It needs to grab 2 adjacent at a time.
  >
  >If it finds one single quote, it needs to grab all characters until it
  >sees and other single quote. Yes, it needs to be able to handle an
  >embedded pair of single quotes.
  >
  >So, if I have this...
  >
  > EEEE 'is walter''s birthday'
  >
  >This should give me 3 tokens
  > 1) EEEE
  > 2) a SPACE
  > 3) is walter's birthday
  >
  >I can grab all but #3! :(
  >
  >I have been banging my head for 3 days on this one, I just can't see it.
  >
  >Help?
  >
  >Walter
  >
  >_______________________________________________
  >Javascript mailing list
  >Javascript@xxxxxxxxxx
  >https://lists.LaTech.edu/mailman/listinfo/javascript


----------------------------------------------------------------------------
--
  MSN Photos is the easiest way to share and print your photos: Click Here
  _______________________________________________ Javascript mailing list
Javascript@xxxxxxxxxx https://lists.LaTech.edu/mailman/listinfo/javascript

------=_NextPart_000_0020_01C23279.EDA26630
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">


<META content=3D"MSHTML 5.50.4915.500" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D661084901-24072002><FONT face=3DArial color=3D#0000ff =
size=3D2>I am=20
trying to keep to the standard on how to deal with date=20
parsing...,</FONT></SPAN></DIV>
<DIV><SPAN class=3D661084901-24072002><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D661084901-24072002><FONT face=3DArial color=3D#0000ff =

size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A=20
href=3D"http://java.sun.com/products/jdk/1.1/docs/api/java.text.SimpleDat=
eFormat.html">http://java.sun.com/products/jdk/1.1/docs/api/java.text.Sim=
pleDateFormat.html</A></FONT></SPAN></DIV>
<DIV><SPAN class=3D661084901-24072002><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D661084901-24072002><FONT face=3DArial color=3D#0000ff =
size=3D2>The=20
Java specs follow the 'C' specs</FONT></SPAN></DIV>
<DIV><SPAN class=3D661084901-24072002><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D661084901-24072002><FONT face=3DArial color=3D#0000ff =

size=3D2>Walter</FONT></SPAN></DIV>
<DIV><SPAN class=3D661084901-24072002></SPAN>&nbsp;</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid">
  <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B> =
javascript-admin@xxxxxxxxxx=20
  [mailto:javascript-admin@xxxxxxxxxx]<B>On Behalf Of </B>Chris=20
  Berry<BR><B>Sent:</B> Tuesday, July 23, 2002 6:34 PM<BR><B>To:</B>=20
  javascript@xxxxxxxxxx<BR><B>Subject:</B> Re: [Javascript] Q on=20
  parsing<BR><BR></FONT></DIV>
  <DIV>
  <DIV>
  <P>&nbsp;&nbsp;&nbsp; Just a quick thought, don't you have to use the =
escape=20
  character \ for that?<BR><BR>Chris Berry </P></DIV>compjma@xxxxxxxxxxx =

  <DIV></DIV>
  <DIV></DIV>Systems Administrator=20
  <DIV></DIV>
  <DIV></DIV>JM Associates=20
  <DIV></DIV>
  <DIV></DIV>
  <DIV></DIV>
  <DIV>&nbsp;</DIV>
  <DIV></DIV>
  <DIV><EM>"Ask me for the impossible and I'll do it immediately, =
miracles take=20
  a little longer."</EM></DIV>
  <DIV></DIV>
  <DIV></DIV>
  <DIV></DIV>
  <DIV></DIV>&gt;From: Walter Torres <WALTER@xxxxxxxxxxxxx>
  <DIV></DIV>&gt;Reply-To: javascript@xxxxxxxxxx=20
  <DIV></DIV>&gt;To: Walter Torres <WALTER@xxxxxxxxxxxxx>
  <DIV></DIV>&gt;CC: <JAVASCRIPT@xxxxxxxxxxxxxxx>, =
<JAVASCRIPT@xxxxxxxxxx>
  <DIV></DIV>&gt;Subject: [Javascript] Q on parsing=20
  <DIV></DIV>&gt;Date: Tue, 23 Jul 2002 20:18:30 -0500 (CDT)=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;I am 99% complete on a date format parser.=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;(will post when this question is answerd!)=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;The last item is how to parse out a substring bracketed =
by=20
  single quotes.=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;i.e.:=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;I have this var...=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt; var format =3D "EEEE, MMMM dd, yyyy ''G'' 'at' =
hh:mm:ss a z" ;=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;I can walk down this string and pull out "tokens" (same =

  character of 1 or=20
  <DIV></DIV>&gt;more in length: ex: EEEE, hh, z )=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;I do it like this...=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt; while ( i &lt; intFormatLen )=20
  <DIV></DIV>&gt; {=20
  <DIV></DIV>&gt; var token =3D "";=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt; curChar =3D strFormat.charAt(i);=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt; while (( strFormat.charAt(i) =3D=3D curChar ) =
&amp;&amp; ( i &lt;=20
  intFormatLen ))=20
  <DIV></DIV>&gt; token +=3D strFormat.charAt(i++);=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt; result +=3D formatOptions ( token );=20
  <DIV></DIV>&gt; }=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;Now, a double single quote (2 in a row) needs to be =
grapped and=20
  passed on=20
  <DIV></DIV>&gt;as a single token. but not 3 in a row, the third should =
be part=20
  of the=20
  <DIV></DIV>&gt;next token. It needs to grab 2 adjacent at a time.=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;If it finds one single quote, it needs to grab all =
characters=20
  until it=20
  <DIV></DIV>&gt;sees and other single quote. Yes, it needs to be able =
to handle=20
  an=20
  <DIV></DIV>&gt;embedded pair of single quotes.=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;So, if I have this...=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt; EEEE 'is walter''s birthday'=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;This should give me 3 tokens=20
  <DIV></DIV>&gt; 1) EEEE=20
  <DIV></DIV>&gt; 2) a SPACE=20
  <DIV></DIV>&gt; 3) is walter's birthday=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;I can grab all but #3! :(=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;I have been banging my head for 3 days on this one, I =
just=20
  can't see it.=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;Help?=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;Walter=20
  <DIV></DIV>&gt;=20
  <DIV></DIV>&gt;_______________________________________________=20
  <DIV></DIV>&gt;Javascript mailing list=20
  <DIV></DIV>&gt;Javascript@xxxxxxxxxx=20
  <DIV></DIV>&gt;https://lists.LaTech.edu/mailman/listinfo/javascript=20
  <DIV></DIV></DIV><BR clear=3Dall>
  <HR>
  MSN Photos is the easiest way to share and print your photos: <A=20
  href=3D"http://g.msn.com/1HM1ENUS/c156??PI=3D44364";>Click=20
  Here</A><BR>_______________________________________________ Javascript =
mailing=20
  list Javascript@xxxxxxxxxx=20
https://lists.LaTech.edu/mailman/listinfo/javascript</BLOCKQUOTE></BODY><=
/HTML>

------=_NextPart_000_0020_01C23279.EDA26630--