Author Topic: Check data ,Return "T" or "nil " I'm in trouble  (Read 5268 times)

0 Members and 1 Guest are viewing this topic.

AIberto

  • Guest
Re: Check data ,Return "T" or "nil " I'm in trouble
« Reply #15 on: July 15, 2015, 10:01:52 PM »
Code at #3 returns T. Is it correct?


Dear kpblc,

eg: data.txt
Code: [Select]
ABCDEF123
0
3012400
3024000

If I want  only change the value of Second row , Other values unchanged

Have a quick way ? Thanks.

You would need to read & re-write the file, e.g.:


Very Thanks , Lee .  :angel:

I think the wrong,I thought , if the value unchange, so no need rewrite .  :embarrassed:


Lee ,Good function , (setq lin (1- lin)) good idea.

I learned a new function "foreach"  , foreach is  like DOS command " FOR"  :lmao:

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Check data ,Return "T" or "nil " I'm in trouble
« Reply #16 on: July 15, 2015, 11:53:00 PM »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Check data ,Return "T" or "nil " I'm in trouble
« Reply #17 on: July 16, 2015, 07:46:34 AM »
HINT: Look in CADR & SUBST

Thanks ,ronjonp , SUBST  is useful !

Just be aware that subst will substitute ALL occurrences of the item, not just the second line.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Check data ,Return "T" or "nil " I'm in trouble
« Reply #18 on: July 16, 2015, 08:53:07 AM »
HINT: Look in CADR & SUBST

Thanks ,ronjonp , SUBST  is useful !

Just be aware that subst will substitute ALL occurrences of the item, not just the second line.
Good to note Lee  8)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

AIberto

  • Guest
Re: Check data ,Return "T" or "nil " I'm in trouble
« Reply #19 on: July 16, 2015, 09:00:25 AM »
HINT: Look in CADR & SUBST

Thanks ,ronjonp , SUBST  is useful !

Just be aware that subst will substitute ALL occurrences of the item, not just the second line.

Thanks again , Lee , I haven't test with "SUBST" , Thanks for reminding .

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Check data ,Return "T" or "nil " I'm in trouble
« Reply #20 on: July 16, 2015, 12:53:26 PM »
e.g.:
Code - Auto/Visual Lisp: [Select]
  1. _$ (subst "a" "b" '("b" "c" "d" "b" "e"))
  2. ("a" "c" "d" "a" "e")

Good to note Lee  8)

Cheers Ron  :-)