php – Get nice name of category from slug (remove dashes of category)

I have a function in a theme:

$category = isset($_GET('category')) ? wp_unslash($_GET('category')) : '';

The problem is that it outputs my categories like this:

“test-category”

I want, however, to show: “Test Category”, just like it’s saved in the backend, without the dashes and the smaller letters.

Is there a way I can get rid of this slug and use the nicename instead? I tried a lot of things (like the get_term_by() function), but nothing works for me. I guess it’s because of the fact that I am using the $category variable.

Can someone help me?