[Javascript] Q on parsing

Walter Torres walter at torres.ws
Tue Jul 23 20:51:16 CDT 2002


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 at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
Behalf Of Chris Berry
  Sent: Tuesday, July 23, 2002 6:34 PM
  To: javascript at LaTech.edu
  Subject: Re: [Javascript] Q on parsing


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

  Chris Berry

  compjma at hotmail.com
  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 at LaTech.edu
  >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 at LaTech.edu
  >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 at LaTech.edu https://lists.LaTech.edu/mailman/listinfo/javascript
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20020723/d18400c2/attachment.htm>


More information about the Javascript mailing list