EmEditor (text editor) Forum Index Questions and Answers about Macros
Macro which can cut the part of the string | Register To Post |
| Threaded | Newest First | Previous Topic | Next Topic | Bottom |
| Poster | Thread |
|---|---|
| jadde29 | Posted on: 9/6/2008 1:36 pm |
Just popping in ![]() ![]() Joined: 9/6/2008 From: Posts: 6 |
Macro which can cut the part of the string Hello,
I have tried to create a macro which cut the file name in the whole path string Maybe example makes things clear I have a string which is the whole path to the file like: C:\folder_1\folder_2\myfile.ext I need a macro which can cut the last part of the string leaving only the path like that: C:\folder_1\folder_2\ Of course, the length of the name of the file is unknown. I've tried to find a solution but still no clue how it can be done. Please help gurus, I need it badly Thanx for your time |
| yorkane | Posted on: 9/6/2008 7:35 pm |
Just popping in ![]() ![]() Joined: 8/14/2008 From: Posts: 5 |
Re: Macro which can cut the part of the string var fullFileName = 'C:\\folder_1\\folder_2\\myfile.ext';
var i = fullFileName.lastIndexOf('\\') +1; var path = fullFileName.substring(0,i); alert(path); |
| jadde29 | Posted on: 9/7/2008 5:53 am |
Just popping in ![]() ![]() Joined: 9/6/2008 From: Posts: 6 |
Re: Macro which can cut the part of the string Great thanx yorkane
Just two questions: Can the result be saved or copied to the clipboard instead of pop-up window? Can it be more universal-I mean when the path is different or when the text file contains many path strings? Once again, great thanx for the responce |
| Threaded | Newest First | Previous Topic | Next Topic | Top |
| Register To Post | |


