Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #13381
| From | abk <asha.bagesh@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | parser ( based on position) |
| Date | 2012-04-04 00:37 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <c94b3902-ba3c-464c-9fce-c3533641cbc9@px4g2000pbc.googlegroups.com> (permalink) |
Is it possible to do the following in java : I want to parse strings and store them in a list and eventually store it in a table. The problem is strings have substrings which appear in different positions and have different delimiters . I have given examples of strings. I am thinking of the following ========================== Have formats defined for Strings ( as shown below) Can we map a string to a particular format with this delimiter and build a "key/value" list ( which can be dumped into db. Key matches column name) I dont know if this is a good idea and since i am new to java, I dont know how this can be done in java . Any ideas will be of great help. I want a common parser to dump these values . Thanks === String 1 Format1 UnitNo L1 L2 STime speed direction status preading greading freading lreading Ireading PSource Battery1 Battery2 ID i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 o1 o2 o3 o4 o5 o6 o7 o8 o9 o10 o11 o12 a1 a2 a3 a4 a5 ^ID|Uid|L1|L2|Stime|Speed|Direction|Status|preading|greading|Ireading1| Ireading2|Psource|Battery1|Battery2|I1|I2|I3|UnitNo............. ^0609|8|2829.49673|07704.82322|13.627|130.59|140312075012|2|0|A|1|0|0| 0|3.015600|12.230000|2748.26|76373.00|352024027728165|! String 2 Format2 UnitNo L1 L2 Stime Speed Direction Status I1 I2 I3 Preading Ireading Battery1 preading1 greading1............. FC03 00140700 00007D04 0002E702 0001624F 00C02A9D 049C5D4C 00000014 00025A39 00000008 000FE348 Format3 String 3 ^id=UnitNo&Pos=<I1><I2><Stime><Speed><Direction>....................... ^id=PTTRK30ES861001000245502&POS=<3.1><1259.429640><07735.382010><084038><260312><0.000><0.0><22><06><0><0><67><0><0><0.09><0.0><5.73><2.2><0><0.0>@
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
parser ( based on position) abk <asha.bagesh@gmail.com> - 2012-04-04 00:37 -0700 Re: parser ( based on position) Roedy Green <see_website@mindprod.com.invalid> - 2012-04-04 12:56 -0700
csiph-web