String Help

String Help

Travis.Biddle
Advocate Advocate
1,235 Views
21 Replies
Message 1 of 22

String Help

Travis.Biddle
Advocate
Advocate

I have a string ("P01-1_P02-2_P03-3").

I need to break the string down so I can compare the ("P01-1_P02-2_P03-3") and see if the values are equal.  The format is always the same with the exception that P01 may be WM01 (example string P01-1_WM02-2).  The dashes and underscores always remain the same.  I cant figure out how to strip the string from start up to the dash, and then from the underscore to the dash, repeating until the end of the string.

 

Any help is much appreciated!

0 Likes
Accepted solutions (3)
1,236 Views
21 Replies
Replies (21)
Message 21 of 22

Kent1Cooper
Consultant
Consultant

@Travis.Biddle wrote:

....

(defun c:ParseBy_then- (str / LM:str->lst)

....

If I load the program and execute command "C:ParseBy_Then-"   I get a "too few arguments error"


(defun C: commands are not supposed to take arguments.  If you want to use it and feed in a string as an argument in the usage, it needs to be a function definition, without the C:, not a command definition.

 

(defun ParseBy_then- (str / LM:str->lst)

 

and the usage would be not as a command, but as a function, in parentheses, including the argument:

(ParseBy_then- "YourStringArgument")

Kent Cooper, AIA
0 Likes
Message 22 of 22

Travis.Biddle
Advocate
Advocate

I didnt see the link when I read the initial comment.  Thank you for sending that, I am going to read it right now!

0 Likes