Nifty function required
Darren Reely
darren.reely at latticesemi.com
Thu Dec 15 12:29:04 CST 2005
OK, I should have said; Extra coding left to the user. But here it is then.
def a char*10 = "1234567"
define a2 char*10 = a[1:index(a, ',') - 1] &
+ a[index(a, ',') + 1 : 10] &
if 0 < index(a, ',') &
else a
define a3 char*10 = a2[1:index(a2, ',') - 1] &
+ a2[index(a2, ',') + 1 : 10] &
if 0 < index(a2, ',') &
else a2
report a a3
Darren
David Morrison - Corporate wrote:
> Darren,
>
> I think that'll blow up if it doesn't find commas, as the value of INDEX
> = 0.
>
> David Morrison
> McBride Electric
>
> -----Original Message-----
> From: powerh-l-bounces+dmorrison=mcbrideelectric.com at lists.sowder.com
> [mailto:powerh-l-bounces+dmorrison=mcbrideelectric.com at lists.sowder.com]
> On Behalf Of Darren Reely
> Sent: Thursday, December 15, 2005 9:59 AM
> To: fernando.olmos at hpa.com.au
> Cc: powerh-l at lists.sowder.com
> Subject: Re: Nifty function required
>
> Fernando,
>
> Here is one wacky way to do it. Since 10 characters can only hold
> nn,nnn,nnn in a standard format, you only require two lines. One for
> each possible comma.
>
> def a char*10 = "1,234,567"
> define a2 char*10 = a[1:index(a, ',') - 1] &
> + a[index(a, ',') + 1 : 10]
> define a3 char*10 = a2[1:index(a2, ',') - 1] &
> + a2[index(a2, ',') + 1 : 10]
> report a a3
>
>
> Darren.
>
>
> fernando.olmos at hpa.com.au wrote:
>
>>Hi gang,
>>
>>To save me re-inventing the wheel (and I won't take the credit - I
>>promise!), I need a set of defines that will strip off comma
>
> characters
>
>>"," from a field with numerics.
>>
>>i.e. def a char*10 = "1,234"
>> def b = ncon(a)
>> rep b
>>
>>this gives ZERO
>>
>>obviously, what I need is to report... 1234 and not 0.
>>
>>I can do it with ten defines and later concatenating them into a
>
> single
>
>>define, then later converting that to a numeric, but there could be a
>>"one line" solution? ;)
>>
>>Thanks
>>
>>/Fernando Olmos/
>>*MIS*
>>*Senior Analyst Programmer*
>>
>>*HPA***
>>Direct: 03 9217 5411
>>Mobile: 0410 382 857
>>Fax: 03 9217 5716
>>
>>___*www.hpa.com.au*_
>><file:///H:/Appdata/Microsoft/Signatures/www.hpa.com.au>
>>
>>
>>**********************************************************************
>>IMPORTANT
>>The contents of this e-mail and its attachments are confidential and
>
> intended
>
>>solely for the use of the individual or entity to whom they are
>
> addressed. If
>
>>you received this e-mail in error, please notify the HPA Postmaster,
>
> postmaster at hpa.com.au,
>
>>then delete the e-mail.
>>This footnote also confirms that this e-mail message has been swept
>
> for the
>
>>presence of computer viruses by Ironport. Before opening or using any
>>attachments, check them for viruses and defects.
>>Our liability is limited to resupplying any affected attachments.
>>HPA collects personal information to provide and market our services.
>
> For more
>
>>information about use, disclosure and access see our Privacy Policy at
>>www.hpa.com.au
>>**********************************************************************
>>
More information about the powerh-l
mailing list