Author Topic: Make strange string in to a list?  (Read 10759 times)

0 Members and 1 Guest are viewing this topic.

jeff101217

  • Guest
Make strange string in to a list?
« on: April 01, 2010, 01:27:00 AM »
hi! everybody,i have a question as follow,need your help

i use autolisp created these strings by reading a text data as follow;

"*jsyq_g_list*G1*G2*G3*G4*G5*"
"*jsyq_p_list*P1*P2*P3*P4*P5*P6*"
"*jsyq_e_list*E1*E2*E3*E4*E5*E6*E7*"
"*jsyq_m_list*M1*M2*M3*M4*M5*M6*M7*M8*"
"*jsyq_h_list*H1*H2*H3*H4*H5*H6*H7*H8*H9*"
"*jsyq_b_list*B1*B2*B3*B4*B5*B6*B7*B8*B9*B10*"

i want change these strings in to string lists as follow

("jsyq_g_list""G1""G2""G3""G4""G5")
("jsyq_p_list""P1""P2""P3""P4""P5""P6")
("jsyq_e_list""E1""E2""E3""E4""E5""E6""E7")
("jsyq_m_list""M1""M2""M3""M4""M5""M6""M7""M8")
("jsyq_h_list""H1""H2""H3""H4""H5""H6""H7""H8""H9")
("jsyq_b_list""B1""B2""B3""B4""B5""B6""B7""B8""B9""B10")

i though this problem for a few days ,can't get the ansewer,
is there any easy ways to solve this?

thanks!

« Last Edit: April 01, 2010, 01:38:41 AM by jeff101217 »

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Make strange string in to a list?
« Reply #1 on: April 01, 2010, 01:30:09 AM »
What was the original question posed by your teacher?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

jeff101217

  • Guest
Re: Make strange string in to a list?
« Reply #2 on: April 01, 2010, 01:35:45 AM »
What was the original question posed by your teacher?

not my teacher's question , i want have a program which can read some items with some rules in the textbook,and put these items in to a dcl list box;

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Make strange string in to a list?
« Reply #3 on: April 01, 2010, 01:38:50 AM »
Show us what have you developed so far.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

jeff101217

  • Guest
Re: Make strange string in to a list?
« Reply #4 on: April 01, 2010, 01:45:41 AM »
Show us what have you developed so far.

my program ,

(defun jsyq_read_basic_data()
  (setq jsyq_read_data_circle_check 0)
  (setq jsyq_read_data_text (open "c:\\lisp\\Datas\\jsyq_datas.txt" "r"))
  (setq jsyq_data_list '() jsyq_read_str 0)
  (while (= jsyq_read_data_circle_check 0)
    (if (/= jsyq_read_str nil)
      (progn
   (setq jsyq_read_str (read-line jsyq_read_data_text))
   (setq jsyq_data_list (cons jsyq_read_str jsyq_data_list))
   )
   (setq jsyq_read_data_circle_check 1)
      )
    )
  (setq jsyq_data_list (cdr jsyq_data_list))
  (setq jsyq_data_basic_g_list (cadr (cddddr jsyq_data_list)))
  (setq jsyq_data_basic_p_list (car (cddddr jsyq_data_list)))
  (setq jsyq_data_basic_e_list (car (cdddr jsyq_data_list)))
  (setq jsyq_data_basic_m_list (car (cddr jsyq_data_list)))
  (setq jsyq_data_basic_h_list (car (cdr jsyq_data_list)))
  (setq jsyq_data_basic_b_list (car jsyq_data_list))
  
  )

the items in the textbook

*jsyq_g_list*G1*G2*G3*G4*G5*
*jsyq_p_list*P1*P2*P3*P4*P5*P6*
*jsyq_e_list*E1*E2*E3*E4*E5*E6*E7*
*jsyq_m_list*M1*M2*M3*M4*M5*M6*M7*M8*
*jsyq_h_list*H1*H2*H3*H4*H5*H6*H7*H8*H9*
*jsyq_b_list*B1*B2*B3*B4*B5*B6*B7*B8*B9*B10*

VovKa

  • Water Moccasin
  • Posts: 1629
  • Ukraine
Re: Make strange string in to a list?
« Reply #5 on: April 01, 2010, 03:14:36 AM »
Code: [Select]
(defun vk_StringSubstPat (NewPattern Pattern String / Pos NewPatternLen)
  (setq NewPatternLen (strlen NewPattern))
  (while (setq Pos (vl-string-search Pattern String Pos))
    (setq String (vl-string-subst NewPattern Pattern String Pos))
    (setq Pos (+ Pos NewPatternLen))
  )
  String
)
(mapcar
  (function
    (lambda (s)
      (read (strcat "(\"" (vk_StringSubstPat "\"\"" "*" (vl-string-trim "*" s)) "\")")
      )
    )
  )
  (list "*jsyq_g_list*G1*G2*G3*G4*G5*"
"*jsyq_p_list*P1*P2*P3*P4*P5*P6*"
"*jsyq_e_list*E1*E2*E3*E4*E5*E6*E7*"
"*jsyq_m_list*M1*M2*M3*M4*M5*M6*M7*M8*"
"*jsyq_h_list*H1*H2*H3*H4*H5*H6*H7*H8*H9*"
"*jsyq_b_list*B1*B2*B3*B4*B5*B6*B7*B8*B9*B10*"
  )
)

jeff101217

  • Guest
Re: Make strange string in to a list?
« Reply #6 on: April 01, 2010, 05:01:02 AM »
Code: [Select]
(defun vk_StringSubstPat (NewPattern Pattern String / Pos NewPatternLen)
  (setq NewPatternLen (strlen NewPattern))
  (while (setq Pos (vl-string-search Pattern String Pos))
    (setq String (vl-string-subst NewPattern Pattern String Pos))
    (setq Pos (+ Pos NewPatternLen))
  )
  String
)
(mapcar
  (function
    (lambda (s)
      (read (strcat "(\"" (vk_StringSubstPat "\"\"" "*" (vl-string-trim "*" s)) "\")")
      )
    )
  )
  (list "*jsyq_g_list*G1*G2*G3*G4*G5*"
"*jsyq_p_list*P1*P2*P3*P4*P5*P6*"
"*jsyq_e_list*E1*E2*E3*E4*E5*E6*E7*"
"*jsyq_m_list*M1*M2*M3*M4*M5*M6*M7*M8*"
"*jsyq_h_list*H1*H2*H3*H4*H5*H6*H7*H8*H9*"
"*jsyq_b_list*B1*B2*B3*B4*B5*B6*B7*B8*B9*B10*"
  )
)


thanks a lot~ :lol:

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Make strange string in to a list?
« Reply #7 on: April 01, 2010, 05:35:16 AM »
Another  :-)

Code: [Select]
(defun StringStrip (str)
  ;; Lee Mac  ~  01.04.10

  (defun StringParser (str del)
    (if (setq pos (vl-string-search del str))
      (cons (substr str 1 pos)
            (StringParser (substr str (+ pos 1 (strlen del))) del))
      (list str)))

  (StringParser (vl-string-trim "*" str) "*"))

Code: [Select]
(StringStrip "*jsyq_g_list*G1*G2*G3*G4*G5*")
==> ("jsyq_g_list" "G1" "G2" "G3" "G4" "G5")

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Make strange string in to a list?
« Reply #8 on: April 01, 2010, 08:49:03 AM »
I want to play...

Code: [Select]
;;; Convert string to list, based on separator
;;; #Str - String to convert
;;; #Sep - Separator to break string into items
;;; Ex. - (AT:Str2Lst "1,2,3" ",") -> '("1" "2" "3")
;;; Alan J. Thompson, 11.11.09 / 04.01.10
(defun AT:Str2Lst (#Str #Sep / #Inc #List #Str)
  (while (setq #Inc (vl-string-search #Sep #Str))
    (setq #List (cons (substr #Str 1 #Inc) #List))
    (setq #Str (substr #Str (+ 2 #Inc)))
  ) ;_ while
  (vl-remove "" (reverse (cons #Str #List)))
) ;_ defun

Result:
Code: [Select]
(at:str2lst "*jsyq_g_list*G1*G2*G3*G4*G5*" "*")
("jsyq_g_list" "G1" "G2" "G3" "G4" "G5")


Updated last line of code.
« Last Edit: April 01, 2010, 11:09:09 AM by alanjt »
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Make strange string in to a list?
« Reply #9 on: April 01, 2010, 09:05:14 AM »
Code: [Select]
  ;;++++++++++++++++++
  ;;  parser by CAB 
  ;;++++++++++++++++++
  (defun sparser (str delim / ptr lst)
    (while (setq ptr (vl-string-search delim str))
      (setq lst (cons (substr str 1 ptr) lst))
      (setq str (substr str (+ ptr 2)))
    )
    (reverse (cons str lst))
  )
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Make strange string in to a list?
« Reply #10 on: April 01, 2010, 09:16:29 AM »
LoL
Alan, we basically have the same thing.
However, I'm not sure why I appended mine instead of using cons. :ugly:
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Make strange string in to a list?
« Reply #11 on: April 01, 2010, 10:02:56 AM »
I was looking for the original thread on this subject but could not find it but did find these:

http://www.theswamp.org/index.php?topic=12985.0
http://www.theswamp.org/index.php?topic=19527.0
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Make strange string in to a list?
« Reply #12 on: April 01, 2010, 12:09:21 PM »
The Counterpart: (Can't believe I never wrote one of these.)

Code: [Select]
;;; Convert List to String
;;; L - List to process
;;; S - Separator
;;; Ex. (AT:Lst2Str '("A" "B" "C") ",") -> "A,B,C"
;;; Alan J. Thompson, 04.01.10
(defun AT:Lst2Str (L S)
  (if (cdr L)
    (strcat (vl-princ-to-string (car L)) S (AT:Lst2Str (cdr L) S))
    (vl-princ-to-string (car L))
  ) ;_ if
) ;_ defun
« Last Edit: April 01, 2010, 03:02:51 PM by alanjt »
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Make strange string in to a list?
« Reply #13 on: April 01, 2010, 12:15:55 PM »
Here is another way Alan.

Code: [Select]
(apply 'strcat (mapcar (function (lambda ( a ) (strcat a ","))) '("a" "b" "c")))

Granted you convert yours to a string, but that is easy enough also.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Make strange string in to a list?
« Reply #14 on: April 01, 2010, 12:37:32 PM »
Here is another way Alan.

Code: [Select]
(apply 'strcat (mapcar (function (lambda ( a ) (strcat a ","))) '("a" "b" "c")))

Granted you convert yours to a string, but that is easy enough also.

I've used something similar to that before when creating an ssget layer filter. Problem is, you end up with a trailing ",".
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Make strange string in to a list?
« Reply #15 on: April 01, 2010, 12:51:35 PM »
Thought that might be a concern.  Oh well.  But in the interest of cat skinning.

Code: [Select]
((lambda ( s ) (substr s 1 (1- (strlen s))))(apply 'strcat (mapcar (function (lambda ( a ) (strcat a ","))) '("a" "b" "c"))))
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Make strange string in to a list?
« Reply #16 on: April 01, 2010, 12:52:45 PM »
Thought that might be a concern.  Oh well.  But in the interest of cat skinning.

Code: [Select]
((lambda ( s ) (substr s 1 (1- (strlen s))))(apply 'strcat (mapcar (function (lambda ( a ) (strcat a ","))) '("a" "b" "c"))))
Nice.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

VovKa

  • Water Moccasin
  • Posts: 1629
  • Ukraine
Re: Make strange string in to a list?
« Reply #17 on: April 01, 2010, 12:57:46 PM »
Code: [Select]
(substr (apply 'strcat (mapcar (function (lambda ( a ) (strcat "," a))) '("a" "b" "c"))) 2)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Make strange string in to a list?
« Reply #18 on: April 01, 2010, 01:02:47 PM »
Code: [Select]
(mapcar (function (lambda(x) (setq str (cond (str (strcat str "," x))(x))))) strlist)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Make strange string in to a list?
« Reply #19 on: April 01, 2010, 01:05:15 PM »
Well now I fell dumb. LoL
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Make strange string in to a list?
« Reply #20 on: April 01, 2010, 01:57:15 PM »
Code: [Select]
(apply 'strcat (mapcar 'strcat '("a" "b" "c") '("," "," "")))

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Make strange string in to a list?
« Reply #21 on: April 01, 2010, 02:44:06 PM »
Code: [Select]
(defun Str-Make (lst del / str x)
  (setq str  (car lst))
  (foreach x (cdr lst) (setq str (strcat str del x)))
str)

Code: [Select]
(defun Str-Make (lst del / str)
  (setq str (car lst))
  (while (setq lst (cdr lst)) (setq str (strcat str del (car lst))))
str)
« Last Edit: April 01, 2010, 02:52:13 PM by Lee Mac »

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Make strange string in to a list?
« Reply #22 on: April 01, 2010, 02:50:10 PM »
Code: [Select]
(defun Str-Make (lst del / str x)
    (setq str  (car lst))
    (foreach x (cdr lst) (setq str (strcat str del x)))
  str)

Code: [Select]
(defun Str-Make (lst del / str)
  (setq str (car lst))
  (while (setq lst (cdr lst)) (setq str (strcat str del (car lst))))
  str)
Very cool Lee! And to think, I was pretty happy with my recursive one.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Make strange string in to a list?
« Reply #23 on: April 01, 2010, 02:51:41 PM »
Very cool Lee! And to think, I was pretty happy with my recursive one.

Thanks Alan, just adding to the mix  8-)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Make strange string in to a list?
« Reply #24 on: April 01, 2010, 03:03:42 PM »
Just wrapped 8-)
Code: [Select]
(defun Str-Make (lst del / str)
  (mapcar (function (lambda(s) (setq str (if str (strcat str del s) s)))) lst)
  str
)
Code: [Select]
(defun Str-Make (lst del / str f)
  (apply 'strcat (mapcar (function (lambda (s) (setq f (if f (strcat del s) s)))) lst))
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

KewlToyZ

  • Guest
Re: Make strange string in to a list?
« Reply #25 on: April 01, 2010, 04:28:47 PM »
 :?

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Make strange string in to a list?
« Reply #26 on: April 01, 2010, 04:33:18 PM »
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Make strange string in to a list?
« Reply #27 on: April 01, 2010, 04:56:22 PM »
Looks like someone working on "String Theory" :evil:
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

jeff101217

  • Guest
Re: Make strange string in to a list?
« Reply #28 on: April 01, 2010, 09:20:31 PM »
Another  :-)

Code: [Select]
(defun StringStrip (str)
  ;; Lee Mac  ~  01.04.10

  (defun StringParser (str del)
    (if (setq pos (vl-string-search del str))
      (cons (substr str 1 pos)
            (StringParser (substr str (+ pos 1 (strlen del))) del))
      (list str)))

  (StringParser (vl-string-trim "*" str) "*"))

Code: [Select]
(StringStrip "*jsyq_g_list*G1*G2*G3*G4*G5*")
==> ("jsyq_g_list" "G1" "G2" "G3" "G4" "G5")

 :-D :lol: great!

jeff101217

  • Guest
Re: Make strange string in to a list?
« Reply #29 on: April 01, 2010, 09:29:11 PM »
thanks a lot every one , i think this problem is solved;and  i got some new thought . :-D

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Make strange string in to a list?
« Reply #30 on: April 02, 2010, 07:48:37 AM »
You're welcome Jeff :-)

You've now got plenty of examples to learn from  :-)

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: Make strange string in to a list?
« Reply #31 on: July 20, 2010, 10:53:06 AM »
Hi :) thanks for all your contribution~

Because I often need to deal with txt data, so the delim is not only one char, but maybe like " \t\n,;"

(" \t\n,;" means " " "\t" "n" "," ";"  can all be delims)

so, for a delim represent more than one char, I write such code, I hope you can shorten it :)

Code: [Select]
;;;by qjchen@gmail.com
(defun q:str:delim(str delim / l1 l2)
  (setq str (vl-string->list str) delim (vl-string->list delim))
  (while str
    (if (not (member (car str) delim))
             (setq l1 (cons (car str) l1))
             (if l1 (setq l2 (cons (vl-list->string (reverse l1)) l2) l1 nil))
    )
    (setq str (cdr str))
  )
  (if l1 (setq l2 (cons (vl-list->string (reverse l1)) l2)))
  (reverse l2)
)

(q:str:delim "a,bb c\tdd\ne" " ,\t\n")
(q:str:delim "a,bb c\tdd\ne" " ,\t\n")=> ("a" "bb" "c" "dd" "e")

before I wrote this my own code, I always use the following std-lib function, it can be used in Autocad R14
Code: [Select]
(defun STD-STRING->LIST (s / lst)
  (if (= (type s) 'STR)
    (while (/= s "")
      (setq lst (cons (ascii (substr s 1 1)) lst) s (substr s 2))
    )
  )
  (reverse lst)
)
(defun STD-STRTOK (s delims / len s1 i c lst)
  (setq delims (std-string->list delims)
len (strlen s) s1 "" i (1+ len)
  )
  (while (> (setq i (1- i)) 0)
    (setq c (substr s i 1))
    (if (member (ascii c) delims)
      (if (/= s1 "") (setq lst (cons s1 lst) s1 ""))
      (setq s1 (strcat c s1))
    )
  )
  (if (/= s1 "") (cons s1 lst) lst)
)


(STD-STRTOK "a,bb c\tdd\ne" " ,\t\n")


« Last Edit: July 20, 2010, 11:01:03 AM by qjchen »
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: Make strange string in to a list?
« Reply #33 on: July 20, 2010, 12:32:58 PM »
>  ... std-lib ...
Reini Urban's or Vladimir Nesterovsky's lib(s) is a very good resource to learn from.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: Make strange string in to a list?
« Reply #34 on: July 20, 2010, 08:14:02 PM »
Maybe this?

http://www.theswamp.org/index.php?topic=22034.msg265916#msg265916

Alan, it seems not the all the same as this post.

in my code, the delim need not to be multi continuous char, but like a list of delim,

" \t\n,;" means " " "\t" "\n" "," ";"  can all be delim separately, need not to be adjacent.

sorry for my poor English, I am not sure can you understand my meaning.

To Seven: I also learn a lot from Reini Urban's STD-LIB function.



http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

hermanm

  • Guest
Re: Make strange string in to a list?
« Reply #35 on: July 20, 2010, 08:56:09 PM »
Code: [Select]
;;;-------------------strtok------------
;;;creates a list of tokens from a delimited string
;;;delim must be one distinct character, but may be repeated
;;;-----------------------------------------
(defun strtok (str delim / out pos)
  (setq delim (ascii delim))
  (while (setq pos (vl-string-position delim str))
    (if (> pos 0);not just adjacent delimiters
      (setq out (cons (substr str 1 pos) out))
    )
    (setq str (substr str (+ 2 pos)))
  )
  (if (> (strlen str) 0);not a trailing delimiter
    (reverse (cons str out))
    (reverse out)
  )
);strtok
Code: [Select]
Command: (strtok "*jsyq_p_list*P1*P2*P3*P4*P5*P6*" "*")
("jsyq_p_list" "P1" "P2" "P3" "P4" "P5" "P6")

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Make strange string in to a list?
« Reply #36 on: July 21, 2010, 05:58:26 PM »
Perhaps:

Code: [Select]
(defun LM:StringParser ( str del )
  ;; © Lee Mac  ~  14.06.10
  (if (setq pos (vl-string-search del str))
    (vl-remove ""
      (cons (substr str 1 pos)
        (LM:StringParser
          (substr str (+ pos 1 (strlen del))) del
        )
      )
    )
    (list str)
  )
)

efernal

  • Bull Frog
  • Posts: 206
Re: Make strange string in to a list?
« Reply #37 on: April 09, 2012, 09:50:14 AM »
I use this...
Code - Auto/Visual Lisp: [Select]
  1. (DEFUN ef_destrincha (string chars / cn id sn lista saida)
  2.   (SETQ sn    (STRLEN string)
  3.         cn    1
  4.         saida ""
  5.         lista nil
  6.   )
  7.   (REPEAT sn
  8.     (SETQ id   (CAR chars)
  9.           char (SUBSTR string cn 1)
  10.     )
  11.     (IF (/= char id)
  12.       (SETQ saida (STRCAT saida char)
  13.             cn    (1+ cn)
  14.       )
  15.       (SETQ string (SUBSTR string (1+ cn))
  16.             lista  (APPEND lista (LIST saida))
  17.             saida  ""
  18.             cn     1
  19.             chars  (IF chars
  20.                      (CDR chars)
  21.                      nil
  22.                    )
  23.       )
  24.     )
  25.   )
  26.   (IF (AND string (> (STRLEN string) 0))
  27.     (SETQ lista (APPEND lista (LIST string)))
  28.   )
  29.   lista
  30. )
  31.  
  32. (ef_destrincha
  33.   "Vamos:ver o que|podemos fazer com[esta rotina de \"ef_destrincha\"]baseada em listas"
  34.   '(":" "|" "[" "]")
  35. )
  36. (ef_destrincha
  37.   "Let's see:what we can do|with this[\"ef_destrincha\" routine]based on lists"
  38.   '(":" "|" "[" "]")
  39. )
  40. ;;      returns
  41. ("Vamos" "ver o que" "podemos fazer com" "esta rotina de \"ef_destrincha\"" "baseada em listas")
  42. ("Let's see" "what we can do" "with this" "\"ef_destrincha\" routine" "based on lists")
  43.  
e.fernal