Verifying a minus sign

Verifying a minus sign

Henrik_Lo
Collaborator Collaborator
453 Views
4 Replies
Message 1 of 5

Verifying a minus sign

Henrik_Lo
Collaborator
Collaborator

HI

 

I have a text, drawing name, within that are at value I need to calculate.

I need to calculate the value, but need to know if there is a minus. I need to know have many

places “substr” need, to get the value, if it is a minus, I need 4 digits if it is positive I only need 3 digits to get the value it out.

 

22-23910_PL_-0.1__AME_-0.7.dwg

22-23910_PL_0.1__AME_-0.7.dwg

 

(Setq NEL_PL (substr (getvar "dwgname") 13 1))                   ;Getting the value, I this case a minus sign

(setq NEL_PL_N (read NEL_PL))                                               ;change it to normal sign.

 

if I compare ( = NEL_PL_N -) I do not get T

If I do the same like this (= - -) I get T

 

WHY

 

Regards

Henrik

0 Likes
Accepted solutions (1)
454 Views
4 Replies
Replies (4)
Message 2 of 5

komondormrex
Mentor
Mentor

hey,

when comparing symbols they need to be quoted like in (= '- NEL_PL_N). minus function is quoted.

0 Likes
Message 3 of 5

paullimapa
Mentor
Mentor
Accepted solution

Curious as to why you don’t just continue to compare the character as a dash “-“ placed in a file name? Don’t need to use the read function but just do a character check like this

( = NEL_PL_N “-“)


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 4 of 5

Henrik_Lo
Collaborator
Collaborator

Hi thangs to you two, it´s seem to be working, jubiii.

 

Regards

Henrik

0 Likes
Message 5 of 5

paullimapa
Mentor
Mentor

glad to have helped...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes