Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Trimming down an unknown string

$
0
0

I have a section code in a program of mine that's supposed to trim off parts of a folder name to get a version number that's on the folder name. Typically the folders are names such as:

Module.8.0.123.0.web.shipped

Though I discovered more recently that some don't have .web, but that the 0 at the end is more reliable. However, I seem to be having a trouble cutting off things after the second 0. What I'd like to do is first trim it down to:

Module.8.0.123.0

and not:

Module.8.0

I've been using -replace but how might I do this in one line better? I'm not looking for a fancy multi-line way to do this but an efficient method. Other wise it would probably just be easier for me to remove the web or the shipped if there's no web in it.


Viewing all articles
Browse latest Browse all 6937

Trending Articles