I've been learning English for 5 years, but I don't understand when or how to use underline character (_) in English.
Please can you help me explain it to me?
Example about hyphen, I read here and then I understood it. But underline I can't.
To quote from one of the links: To underscore something in a piece of writing that is particularly important: “books are not to be placed on the floor.” The underline gives the word a bit more gravity. When spoken, the words "are not" would be stressed or emphasized over the other words in the sentence.
I can't figure out how to underline here, but "are not" should be underlined, though italics lends a similar emphasis.
You would use it similarly to when you might stress a word in a sentence because it is more important.
For the underscore however, it iss primarily used in programming in places which a space is not allowed (or inconvenient, like a file name). It's origin is the typewriter, where it was used to underline words, see here
The underline (or underscore—the two terms mean the same thing) is not used as a separate character in ordinary written English. It is only used beneath characters to indicate emphasis. That's why it's called an underline.
In programming contexts, however, it is often used to replace an orthographic space, as in variable and function names, or your example:
This is because most programming languages treat an actual space as the separator between tokens, so you can't have spaces inside a name. For instance, if you have two functions named 'Print Now' and 'Print Later', your compiler will interpret these as commands to 'Print' the (probably non-existent) entities 'Now' and 'Later'.
Consequently, programmers often use the underscore character so the two parts of the name are bound together for the compiler but separated for the human reader: 'Print_Now' and 'Print_Later'.
"Camel case" is another device for accomplishing the same thing: 'PrintNow' and 'PrintLater'.