CadFrank Posted July 19, 2016 Posted July 19, 2016 Hi, I've got a string that contains "(Value)" and i'd like to count them. What functions whould i use? Quote
Roy_043 Posted July 19, 2016 Posted July 19, 2016 Count occurrences or add values? Single string with multiple occurrences or multiple strings? Quote
CadFrank Posted July 19, 2016 Author Posted July 19, 2016 Count the caracters between the Parenthese in a single string Quote
Roy_043 Posted July 19, 2016 Posted July 19, 2016 (vl-string-position (ascii "(") "aa(bbb)cccc") Quote
CadFrank Posted July 19, 2016 Author Posted July 19, 2016 (defun parPosition (string / PositionStart PositionEnd) (setq PositionStart (vl-string-position (ascii "(") string)) (setq PositionEnd (vl-string-position (ascii ")") string)) (setq Count (- PositionEnd PositionStart)) Count ) Like this Quote
CadFrank Posted July 19, 2016 Author Posted July 19, 2016 How do I control an error of if block not selected return to the beginning? Quote
Roy_043 Posted July 19, 2016 Posted July 19, 2016 (defun parPosition (string / PositionStart PositionEnd) (setq PositionStart (vl-string-position (ascii "(") string)) (setq PositionEnd (vl-string-position (ascii ")") string)) (setq Count (- PositionEnd PositionStart)) Count ) Like this Not quite. You should subtract 1 from count. Quote
Roy_043 Posted July 19, 2016 Posted July 19, 2016 How do I control an error of if block not selected return to the beginning? You should start a new topic. And explain better. Quote
satishrajdev Posted July 20, 2016 Posted July 20, 2016 Try this once (vl-list->string (reverse (member 41 (reverse (member 40 (vl-string->list "aa(bbb)cccc")))))) Quote
Recommended Posts
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.