AGG Software Forums

Online Help Center => Data loggers and plug-ins => Topic started by: dafrenchman on August 12, 2020, 07:44:59 PM



Title: leading zeros
Post by: dafrenchman on August 12, 2020, 07:44:59 PM
Allo,

Is there a way to remove leading zeros in a parsed string item?
I think maybe via expressions plugin?

Example

0088-190031 should become 88-190031

Thanks,
                                                                                                                                                                                                                                                                                                                                                                       


Title: Re: leading zeros
Post by: Arthur Grasin on August 13, 2020, 07:20:03 AM
Hello,

Could you please show me your full data packet. It is possible, you may use a regular expression to extract data as you want.

Otherwise, you should use the "Script execute" plugin.


Title: Re: leading zeros
Post by: dafrenchman on August 21, 2020, 03:46:27 PM
Allo,

Below are 2 data packets. with desired results.

First sample

?880698-00-2061    28103@
need to parse as
field 1           880698-00-2      (11 characters)
field 2           061                   (3 characters)
field 3           28103                (up to 9 characters)


Second sample

?0088-190031061    28230@
need to parse as
field 1           88-190031         (9 characters with first leading 0 dropped)
field 2           061                    (3 Characters)
field 3           28230                (up to 9 characters)


I hope this can be done.

Thanks.


Title: Re: leading zeros
Post by: Arthur Grasin on August 22, 2020, 09:16:33 AM
Try the following:

Sart signature: ?
End signature: @
Parse full data packet: yes

The regular expression for the first variable:

\?0*([\d\-]+)\d{3}\ {3}

The regular expression for the second variable:

(\d{3})\ {3}

The regular expression for the 3rd variable:

(\d+)\@


Title: Re: leading zeros
Post by: dafrenchman on August 24, 2020, 06:03:41 PM
Thank you.

Just to make sure I understand.
This would be used in the expressions plugin?

CB


Title: Re: leading zeros
Post by: Arthur Grasin on August 25, 2020, 06:45:16 AM
You should use it in the ASCII Data Parser plugin.