Created
February 2, 2011 14:31
-
-
Save joshz/807745 to your computer and use it in GitHub Desktop.
plugin for python script for notepad++, removes first line item, bet you could use a regex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from string import find | |
def testContents(contents, lineNumber, totalLines): | |
index = string.find(contents, " ") | |
if(index == -1): | |
editor.deleteLine(lineNumber) | |
return 0 | |
else: | |
editor.replaceWholeLine(lineNumber, contents[index+1:]) | |
editor.forEachLine(testContents) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def separate(line): | |
last = line.split()[-1] | |
number = [] | |
for char in reversed(last): | |
if char.isdigit(): | |
number.append(char) | |
num_str = "".join(reversed(number)) | |
rebuilt_line = line.rstrip(num_str) | |
return rebuilt_line + " " + num_str |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment