While copying a code snippet from some sites and pdf,docs line numbers are also getting copied.I have to omit those line numbers in my text editor manually always. Any better way so that line numbers won't be copied?

When I copy code from DaniWeb, linenumbers never get copied.

Comments
I see. But while copying from some pdfs,docs this problem arises. However i got a solution for that. Thanks ":)"

writing the code yourself? download the .jar file containing the code?

Comments
I was just talking about copying and pasting the code snippets. .jar file for these are not available usually!

You could write a simple Java program to read a text file, delete any leading integers and write it back out. 15 minutes tops.

Comments
This would be a peculiar way for doing this. However i found a nice and simple way. In sublime text2 using macros i am able to get this thing done easily. Btw thanks for your support.

sash_kp, just a remark on your comment on my reply:
your question stated
"copying a code snippet from some sites and pdf,docs"
the most sites that contain code snippets are more to 'look' at , rather than to copy-paste and use. the best, where they do give you examples that are decently coded, are the official pages, which do come with the code in downloadable form (even a lot of not-so reliable sites offer the code in .java files)
from pdf and docs ... well, if you're working with an e-book, and you have bought it, no doubt the author has given you access to some space where you can download the code used.
if you don't, chances are you downloaded an illegal copy, but how am I to know?

Comments
Well Official sites and legally bought ebooks are not meant for copying and pasting stuffs. My question was very simple. Copying the code snippet and Paste in text editor to verify it works or not. No .jar file,no .java file nothing. Just copying,and whil

@stultuske

When I copy code from DaniWeb, linenumbers never get copied.

I copy code to test it out. The OP is usually rather vague in decribing his problem so I can test his code.

This question has already been answered. Start a new discussion instead.