What are you looking in fact to achive? To check if a given string (i.e. client name) is present or to retrive the name of client (the third folder from root)?


Registered forum members do not see this ad.
Hi,
I'm usingto get my current filepath and i would like to get a specific string from it.Code:(setq Cfilepath (getvar 'DWGPREFIX))
Filepath : "L:\\ECHAFAUDAGES (L2)\\CLIENTS\\Name of client\\Project name\\ingénierie\\PlanCad\\"
Thing is i'm not sure what to use since
Name of client never has the same lenght, and same for project name.
So i can't use substr.
What function should I be looking for ?
What are you looking in fact to achive? To check if a given string (i.e. client name) is present or to retrive the name of client (the third folder from root)?
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
Look into:
vl-string-search
vl-string-position
wcmatch
String to List
Lee Mac Programming
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Just another Swamper


Well Client name will always be present. I just want to retrieve the project name to print it in a .txt file
Then you may use this function:
Use it like:Code:;;++++++++++++++++++ ;; 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)) )
For sure this presume that project name will be always the 4th folder from root.Code:(nth 4 (SPARSER (getvar "DWGPREFIX") "\\"))
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
Maybe also .
substr
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said




Bookmarks