30 Mar 2012 @ 4:37 PM 

I just received a PowerShell question from a community member by direct message through Twitter… His question was: ”struggling to determine the length of a string with contains a numbers as value in PowerShell … any tips?”.
This is actually a very good question since this is something that is done quite a lot Knipogende emoticon And as I came to think about it, I’ve never written anything about that topic so here I am Verlegen emoticon

Let’s take a string you’ve filled with a bunch of characters…

$string = 12345678

When you want to know the number of characters in this string, you can get this information with the following line:

$string | measure-object –character

But… that gives you a few column names and the number of characters…
image

so still too much information (I don’t want those column names, just the number of characters!). To just get the number of characters, use the following line:

$string | measure-object -character | select -expandproperty characters

Which in turn you can put in it’s own variable:

$characters = $string | measure-object -character | select -expandproperty characters

Post to Twitter

Posted By: Jeff Wouters
Last Edit: 25 Apr 2012 @ 08:34 PM

EmailPermalinkComments (0)
Tags
Categories: PowerShell
 30 Mar 2012 @ 11:54 AM 

Just in case you’ve missed it: Somewhere last year I tweeded about a personal project I was working on at the time, Project Methos. This involved starting my own company  which I found out later on was a lot more work than I anticipated Knipogende emoticon
But nevertheless, as from the 1th of February 2012 I started my own company: Methos IT. Emoticon met brede lach

Now that’s up and running I decided to take on a new project… and named it Project Blue Lantern. The same as with Project Methos, I won’t tell what it involves… but maybe a little hint will slip by me on Twitter every once in a while Verhitte emoticon

Post to Twitter

Posted By: Jeff Wouters
Last Edit: 30 Mar 2012 @ 11:54 AM

EmailPermalinkComments (1)
Tags
Categories: Uncategorized

 Last 50 Posts
 Back
Change Theme...
  • Users » 1
  • Posts/Pages » 251
  • Comments » 430
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

About



    No Child Pages.

Contact



    No Child Pages.