From the course: Learning AutoLISP & Visual LISP

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Function: substr

Function: substr

- [Instructor] And previously, we reviewed how you can combine multiple strings into one. We used the STRCAT string cat LISP function. But what if you want to return just a portion of the string? Well that's where we're going to look at the LISP function now sub string. And the arguments you provide simply are the string itself, the starting point of the sub portion of the string that you want to get, and the length of the string. So what do we have here? Well we're going to get the variable ACAD version. We've done this before, and notice that the ACAD version returns a string that contains the version number and other text. This is all one string. So we're going to start and get the sub string starting at the first character, two, and we're going to go one, two, three, four characters over. So all of the number portion of this string. The result: 21.0. We could also start anywhere in the middle. So, one two three, four five six seven, is where the parentheses starts, and even if the…

Contents