Parse Data
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 263
- Joined: Fri Sep 23, 2005 6:49 am
Parse Data
Hi All,
I have a source file with records such as,
dsadsad 3.6L dsfgfdgfdg
weewqd 2.4L dsdsa
vxcvbvbvbvcvccvc2.8Lfgfdgf
if the data in the source file match the pattern 0.0L then I have to output the data. 0.0L pattern will occur only once per each record.
desired data in the output file:
2.6L
2.4L
2.8L
can someone please suggest me how can I accomplish this.
Thanks..
pavan
I have a source file with records such as,
dsadsad 3.6L dsfgfdgfdg
weewqd 2.4L dsdsa
vxcvbvbvbvcvccvc2.8Lfgfdgf
if the data in the source file match the pattern 0.0L then I have to output the data. 0.0L pattern will occur only once per each record.
desired data in the output file:
2.6L
2.4L
2.8L
can someone please suggest me how can I accomplish this.
Thanks..
pavan
Is there only ever the one decimal point (.)? And is the pattern always 0.0L
If so then something like should work
If so then something like
Code: Select all
Right(Input['.',1,1],1):'.':Left(Input['.',2,1],2)
Last edited by ShaneMuir on Mon Nov 21, 2011 9:32 am, edited 1 time in total.
-
- Premium Member
- Posts: 263
- Joined: Fri Sep 23, 2005 6:49 am
Parse data
yes, that is correct. There will be only 1 decimal point. The pattern will always be 0.0L.
And there will be only 1 such pattern in each record. No repetitions or duplicates in the record.
Thanks..
And there will be only 1 such pattern in each record. No repetitions or duplicates in the record.
Thanks..
-
- Premium Member
- Posts: 263
- Joined: Fri Sep 23, 2005 6:49 am
Parse Data
Also there will be other data in the column, I have to match the pattern 0.0L and ignore the rest.
saADSDSADSA2.8Lhhgfhgf
desired output: 2.8L
Thanks
Pavan
saADSDSADSA2.8Lhhgfhgf
desired output: 2.8L
Thanks
Pavan
-
- Premium Member
- Posts: 263
- Joined: Fri Sep 23, 2005 6:49 am
Parse data
Thank You. The code worked.
I guess it would fail because that example has more than one decimal. If the requirements are that narrow, OK. If the data contains other decimals or a.bL or 1.2R instead of 1.2L or in addition to it, then you would need more checks because that logic is based only on locating a single decimal (no other validations). My point is it's not checking for 0-9 on either side and not checking for L after that, so it's not necessarily matching the #.#L pattern.
Choose a job you love, and you will never have to work a day in your life. - Confucius