[wingide-users] find a char by position

Wingware Support support at wingware.com
Thu Oct 18 10:49:24 EDT 2012


John Fabiani wrote:
> I was wondering if Wing could find a character by position.  I'm using 
> wing to edit some sql code and the database logs provide info based on 
> character position.  To make thing worse the error is concerning a 
> linefeed and return (most likely at the end of a line). But which one 
> when the error message provides details like "nonstandard use of 
> escape in a string at character 9627".
>
> Is there a simple way to find position 9627?

Yes, sort of.  Go to position 0 in the file then do Command by Name from 
the Edit menu then type this:

forward-char(repeat=9627)

However, if the file has \r\n newlines it'll overshoot by the number of 
lines before the line you end up on.

Of course there's always this:

f = open('thefile.py')
txt = f.read()
print(txt[9627:])  # Or whatever

-- 

Stephan Deibel
Wingware | Python IDE
Advancing Software Development

www.wingware.com


More information about the wingide-users mailing list