79617999

Date: 2025-05-12 14:03:47
Score: 1
Natty:
Report link

I needed to extract a part from a name where different sections were separated by a dash. In fact the name contained always five dashes.

RegEx will surely work, but I agree it makes it look more complicated than it need to be.
$SignificantPartOfName = $($NameContainingFiveDashes.Split('-')[4]).trim()

Sincerely AndreasM

Reasons:
  • Blacklisted phrase (0.5): I need
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: andreas Meyer