File: ReverseAssignment.py

package info (click to toggle)
drpython 161-3.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,588 kB
  • ctags: 1,470
  • sloc: python: 15,817; sh: 358; makefile: 43
file content (21 lines) | stat: -rw-r--r-- 481 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#drscript

#By Daniel Pozmanter
#Released under the GPL

endOfLineChar = DrDocument.GetEndOfLineCharacter()
targets = DrDocument.GetSelectedText().split(endOfLineChar)
l = len(targets)
c = 0
newselection = ""
while c < l:
	x = targets[c].find('=')
	
	if x > -1:	
		targets[c] = targets[c][x+2:] + " = " + targets[c][0:x]	
	newselection = newselection + targets[c]
	if c < (l - 1):
		newselection = newselection + endOfLineChar
	c = c + 1
		
DrDocument.SetSelectedText(newselection)