In powershell I have different strings with e.g. the following content (3 different examples):
name_something_else_10
another_name_200
what_ever_you_like_1234567
I want to cut of everything after the last underscore. So what I want to get is the following:
name_something_else
another_name
what_ever_you_like
Each string is provided as a variable, and I need the result in a variable as well. What I am then looking for is how to cut the part of the string by using a function like follows:
$newString = CutOffEveryAfterUnderscore $oldString

