Breaking up a string into a char array?
in
Programming Questions
•
1 year ago
Hi,
I am trying to write a program that will take data out of incoming email messages and continually add it to one text file.
I get a new e-mail once every hour with the data in the body of the e-mail in csv format. At the moment I am manually copying and pasting this data into a text file to create a single "daily" csv with data from 24 emails.
The problem is that each email has a header at the top of that I do not want to add as it is not required. So my question is how can I break up the string that contains the entire email message to two strings, one with the header, and one with the data?
Below is an example of what each email looks like:
LogName:EgyDmd Log
DeviceType:9999
SerialNumber:BP-9999A461-11
Owner:JohnSmith
Tag1:TagOne
Tag2:Tracking
RecordNumber, UTC, kWh imp, kWh exp, kWh net, kVARh imp, kVARh exp, kVARh net, kVAh tot, kW swd, kVAR swd, kVA swd, I avg swd, PF sign mean, Vln a, Vln b
791112, 1329847200, 26.1367, 2719.6311, -2693.4939, 0.0000, 1721.2443, -1721.2443, 3902.3708, -0.0181, -0.1300, 0.1318, 0.5333, -13.6475, 123.9576, 123.8317
791111, 1329847140, 26.1367, 2719.6309, -2693.4937, 0.0000, 1721.2421, -1721.2421, 3902.3687, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 123.8513, 123.8284
791110, 1329847080, 26.1367, 2719.6306, -2693.4937, 0.0000, 1721.2399, -1721.2399, 3902.3665, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 124.1091, 124.0858
791109, 1329847020, 26.1367, 2719.6306, -2693.4934, 0.0000, 1721.2378, -1721.2378, 3902.3643, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 124.0138, 123.9492
791108, 1329846960, 26.1367, 2719.6304, -2693.4934, 0.0000, 1721.2357, -1721.2357, 3902.3623, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 124.0390, 123.8813
791107, 1329846900, 26.1367, 2719.6301, -2693.4932, 0.0000, 1721.2335, -1721.2335, 3902.3601, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 123.8170, 123.7664
791106, 1329846840, 26.1367, 2719.6299, -2693.4929, 0.0000, 1721.2313, -1721.2313, 3902.3579, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 120.4414, 125.4450
791105, 1329846780, 26.1367, 2719.6294, -2693.4924, 0.0000, 1721.2291, -1721.2291, 3902.3557, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 120.4200, 125.4964
791104, 1329846720, 26.1367, 2719.6289, -2693.4919, 0.0000, 1721.2271, -1721.2271, 3902.3535, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 120.4403, 125.2715
791103, 1329846660, 26.1367, 2719.6284, -2693.4915, 0.0000, 1721.2249, -1721.2249, 3902.3511, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 123.6215, 123.6050
791102, 1329846600, 26.1367, 2719.6282, -2693.4912, 0.0000, 1721.2227, -1721.2227, 3902.3489, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 123.3703, 123.2455
791101, 1329846540, 26.1367, 2719.6279, -2693.4910, 0.0000, 1721.2205, -1721.2205, 3902.3467, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 123.8804, 123.6362
791100, 1329846480, 26.1367, 2719.6277, -2693.4907, 0.0000, 1721.2184, -1721.2184, 3902.3447, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 123.5670, 123.4529
791099, 1329846420, 26.1367, 2719.6274, -2693.4902, 0.0000, 1721.2162, -1721.2162, 3902.3425, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 123.5965, 123.2797
791098, 1329846360, 26.1367, 2719.6270, -2693.4900, 0.0000, 1721.2140, -1721.2140, 3902.3401, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 123.6886, 123.5114
791097, 1329846300, 26.1367, 2719.6265, -2693.4895, 0.0000, 1721.2117, -1721.2117, 3902.3379, -0.0262, -0.1319, 0.1348, 0.5464, -19.3785, 123.8428, 123.5878
791096, 1329846240, 26.1367, 2719.6260, -2693.4890, 0.0000, 1721.2095, -1721.2095, 3902.3357, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 123.5189, 123.4430
791095, 1329846180, 26.1367, 2719.6255, -2693.4885, 0.0000, 1721.2073, -1721.2073, 3902.3333, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 123.7798, 123.6672
791094, 1329846120, 26.1367, 2719.6252, -2693.4880, 0.0000, 1721.2051, -1721.2051, 3902.3311, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 123.3755, 123.1621
791093, 1329846060, 26.1367, 2719.6248, -2693.4875, 0.0000, 1721.2029, -1721.2029, 3902.3289, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 123.6132, 123.5716
791092, 1329846000, 26.1367, 2719.6243, -2693.4871, 0.0000, 1721.2007, -1721.2007, 3902.3267, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 124.0148, 123.8626
791091, 1329845940, 26.1367, 2719.6238, -2693.4866, 0.0000, 1721.1984, -1721.1984, 3902.3242, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 123.6329, 123.5262
791090, 1329845880, 26.1367, 2719.6233, -2693.4861, 0.0000, 1721.1963, -1721.1963, 3902.3220, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 120.3486, 125.2504
791089, 1329845820, 26.1367, 2719.6228, -2693.4858, 0.0000, 1721.1941, -1721.1941, 3902.3198, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 119.8672, 124.7003
791088, 1329845760, 26.1367, 2719.6226, -2693.4854, 0.0000, 1721.1919, -1721.1919, 3902.3176, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 120.5659, 125.4933
791087, 1329845700, 26.1367, 2719.6221, -2693.4851, 0.0000, 1721.1898, -1721.1898, 3902.3154, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 120.3518, 125.3645
791086, 1329845640, 26.1367, 2719.6218, -2693.4849, 0.0000, 1721.1876, -1721.1876, 3902.3132, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 120.3468, 125.2930
791085, 1329845580, 26.1367, 2719.6213, -2693.4844, 0.0000, 1721.1854, -1721.1854, 3902.3110, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 123.9249, 123.8859
791084, 1329845520, 26.1367, 2719.6208, -2693.4839, 0.0000, 1721.1832, -1721.1832, 3902.3088, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 123.5045, 123.4259
791083, 1329845460, 26.1367, 2719.6204, -2693.4834, 0.0000, 1721.1810, -1721.1810, 3902.3064, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 123.8656, 123.8704
791082, 1329845400, 26.1367, 2719.6199, -2693.4829, 0.0000, 1721.1787, -1721.1787, 3902.3042, -0.0333, -0.1333, 0.1376, 0.5574, -24.1984, 124.0589, 123.9337
791081, 1329845340, 26.1367, 2719.6194, -2693.4824, 0.0000, 1721.1765, -1721.1765, 3902.3020, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 123.7583, 123.6659
791080, 1329845280, 26.1367, 2719.6189, -2693.4819, 0.0000, 1721.1743, -1721.1743, 3902.2996, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 123.9649, 123.8981
791079, 1329845220, 26.1367, 2719.6184, -2693.4812, 0.0000, 1721.1721, -1721.1721, 3902.2974, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 124.0647, 123.7712
791078, 1329845160, 26.1367, 2719.6177, -2693.4807, 0.0000, 1721.1698, -1721.1698, 3902.2949, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 123.9240, 123.8409
791077, 1329845100, 26.1367, 2719.6172, -2693.4802, 0.0000, 1721.1676, -1721.1676, 3902.2927, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 123.9275, 123.6638
791076, 1329845040, 26.1367, 2719.6167, -2693.4797, 0.0000, 1721.1654, -1721.1654, 3902.2905, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 123.5639, 123.2741
791075, 1329844980, 26.1367, 2719.6162, -2693.4792, 0.0000, 1721.1632, -1721.1632, 3902.2881, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 119.9406, 124.7414
791074, 1329844920, 26.1367, 2719.6157, -2693.4785, 0.0000, 1721.1610, -1721.1610, 3902.2859, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 120.1425, 124.9341
791073, 1329844860, 26.1367, 2719.6152, -2693.4780, 0.0000, 1721.1588, -1721.1588, 3902.2837, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 120.2347, 125.2260
791072, 1329844800, 26.1367, 2719.6145, -2693.4775, 0.0000, 1721.1566, -1721.1566, 3902.2815, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 123.8505, 123.7696
791071, 1329844740, 26.1367, 2719.6140, -2693.4771, 0.0000, 1721.1544, -1721.1544, 3902.2791, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 123.5583, 123.4636
791070, 1329844680, 26.1367, 2719.6135, -2693.4766, 0.0000, 1721.1521, -1721.1521, 3902.2769, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 123.9060, 123.6575
791069, 1329844620, 26.1367, 2719.6128, -2693.4758, 0.0000, 1721.1499, -1721.1499, 3902.2744, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 123.4792, 123.1786
791068, 1329844560, 26.1367, 2719.6123, -2693.4753, 0.0000, 1721.1477, -1721.1477, 3902.2722, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 123.6737, 123.3765
791067, 1329844500, 26.1367, 2719.6116, -2693.4746, 0.0000, 1721.1454, -1721.1454, 3902.2698, -0.0337, -0.1331, 0.1376, 0.5582, -24.3553, 123.5349, 123.3396
791066, 1329844440, 26.1367, 2719.6108, -2693.4739, 0.0000, 1721.1432, -1721.1432, 3902.2673, -0.0208, -0.1294, 0.1314, 0.5334, -15.8101, 120.4658, 125.2817
791065, 1329844380, 26.1367, 2719.6104, -2693.4731, 0.0000, 1721.1410, -1721.1410, 3902.2651, -0.0208, -0.1294, 0.1314, 0.5334, -15.8101, 120.3470, 125.3331
791064, 1329844320, 26.1367, 2719.6099, -2693.4727, 0.0000, 1721.1388, -1721.1388, 3902.2629, -0.0208, -0.1294, 0.1314, 0.5334, -15.8101, 122.0616, 124.4857
791063, 1329844260, 26.1367, 2719.6091, -2693.4722, 0.0000, 1721.1366, -1721.1366, 3902.2605, -0.0208, -0.1294, 0.1314, 0.5334, -15.8101, 123.7347, 123.5298
791062, 1329844200, 26.1367, 2719.6086, -2693.4717, 0.0000, 1721.1343, -1721.1343, 3902.2583, -0.0208, -0.1294, 0.1314, 0.5334, -15.8101, 123.7452, 123.7127
791061, 1329844140, 26.1367, 2719.6082, -2693.4712, 0.0000, 1721.1321, -1721.1321, 3902.2561, -0.0208, -0.1294, 0.1314, 0.5334, -15.8101, 123.4254, 123.3575
791060, 1329844080, 26.1367, 2719.6077, -2693.4705, 0.0000, 1721.1299, -1721.1299, 3902.2537, -0.0208, -0.1294, 0.1314, 0.5334, -15.8101, 123.7165, 123.3952
791059, 1329844020, 26.1367, 2719.6069, -2693.4700, 0.0000, 1721.1277, -1721.1277, 3902.2515, -0.0208, -0.1294, 0.1314, 0.5334, -15.8101, 123.1432, 122.9493
791058, 1329843960, 26.1367, 2719.6064, -2693.4695, 0.0000, 1721.1254, -1721.1254, 3902.2490, -0.0208, -0.1294, 0.1314, 0.5334, -15.8101, 123.0088, 122.9920
791057, 1329843900, 26.1367, 2719.6057, -2693.4688, 0.0000, 1721.1232, -1721.1232, 3902.2466, -0.0208, -0.1294, 0.1314, 0.5334, -15.8101, 123.7292, 123.5706
791056, 1329843840, 26.1367, 2719.6050, -2693.4680, 0.0000, 1721.1208, -1721.1208, 3902.2444, -0.0208, -0.1294, 0.1314, 0.5334, -15.8101, 123.6711, 123.3251
791055, 1329843780, 26.1367, 2719.6045, -2693.4673, 0.0000, 1721.1187, -1721.1187, 3902.2419, -0.0208, -0.1294, 0.1314, 0.5334, -15.8101, 123.7488, 123.6541
791054, 1329843720, 26.1367, 2719.6040, -2693.4668, 0.0000, 1721.1165, -1721.1165, 3902.2397, -0.0208, -0.1294, 0.1314, 0.5334, -15.8101, 120.1855, 125.0984
791053, 1329843660, 26.1367, 2719.6035, -2693.4666, 0.0000, 1721.1143, -1721.1143, 3902.2375, -0.0208, -0.1294, 0.1314, 0.5334, -15.8101, 119.7024, 124.5649
1