Skip to content

Instantly share code, notes, and snippets.

@joshz
Created February 2, 2011 14:31
Show Gist options
  • Save joshz/807745 to your computer and use it in GitHub Desktop.
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
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)
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