cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

trimZeroElements( ) ?

lvl107
20-Turquoise

trimZeroElements( ) ?

Hello Everyone.
From :

1.PNG
Need help with the trimZeroElements( ) program function with ORIGIN := 1 and ORIGIN := 0 ?
Thanks in advance for the time and help.
Best Regards.
Loi.

31 REPLIES 31
Werner_E
25-Diamond I
(To:JKT)


@JKT wrote:

I don't have Mathcad at hand now, but the entire implementation of the function in the replace seemed to fail. It silently didn't replace anything, so it never found a match.


@JKT 

I experience no such effects with my functions in Prime 9.

 

Of course the two examples where I replace all numbers smaller than 7 or all odd numbers fail in Prime because of the reasons described in detail in my answer above (lacking of short-circuit evaluation in Prime). For these two examples we need to formulate the boolean argument function a bit different.

 

And of course we can't use hex numbers in Prime because Prime lacks support for them. So the unicode numbers we get from CharMap must be converted to their decimal equivalents. Either manually, or using a user-written utility function or we also may use the built-in "str2num()" function as shown in one of the examples.

 

But otherwise the function does exactly what its supposed to do ...

Werner_E_0-1709320949349.png

Prime 9 file attached

 

JKT
13-Aquamarine
13-Aquamarine
(To:Werner_E)

Never mind - it was a typo.

Announcements

Top Tags