Jump to content

Split string (number and strings) and put all in a list


Recommended Posts

Posted

A very useful function is to extract a number or string (without numbers) from a longer string. This is taken care of by the RIPCAR and RIPNUM functions; but to these I wanted to add one that would split the string for me by separating numbers (integers or real) from strings and put everything in a list.
I found a way .... but I am sure you experts, with 4 VL-xx commands will achieve the same thing much more efficiently!

 

How can I improve the RIPLST function?

RipCarNum.lsp

Posted

So, 1 thing it doesn't account for is notation like: 17.62E+6 (meaning 17620000).  Quite common in Autocad for big coordinates.

I should try making this function.  I need it myself

 

 

 

 

Posted

You might want to consider my Split String function, as part of my Alphanumerical Sort function, previously posted here.

Posted

... I use it to do a sorting of codes consisting of STRING+NUMBER:
Needing to sort '("AA02" "AA10" "AA01") with alphanumeric sorting I would erroneously get ...'("AA01" "AA10" "AA02"), instead using RIPLST for each string, I get '("AA" 2) which I transform to "AA000002", while '("AA" 10) becomes "AA000010": I add zeros and transform it back to string. As a result, the alphanumeric sorting becomes correct, after removing the previously added zeros: '("AA01" "AA02" "AA10").

 

ORDINE.lsp

Posted

Lee Mac you are amazing: your routines contemplate every possible problem! Thank you for existing!

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...