parser ( based on position)

A

abk

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>@
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top