Solved

parse string to int

Posted on 2014-12-02
1
94 Views
Last Modified: 2014-12-03
Hello EE,

I have an object , one of the members is a string ( high depth), I wish to convert those to int. Not sure on the structure to do this . Using the below statement from a select statement ? below gives;

Cannot convert argument "style", with value: "System.Object[]", for "Parse" to type "System.Globalization.NumberStyles

$activity | select object` name, @{ name = 'date' ; expression = { [datetime]::ParseExact($_.date,"yyyy-MM-dd HH:mm:ss",$null)}},put,got,high` depth,queue` mgr,type, @{name = 'HighDepth'; expression ={[int32]::Parse($a,$activity."High Depth")}}

Open in new window

0
Comment
Question by:davesnb
1 Comment
 
LVL 39

Accepted Solution

by:
footech earned 500 total points
ID: 40477266
You should be able to just substitute the following.
@{name = 'HighDepth'; expression ={[int32]$_."High Depth")}}

Open in new window

0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Set OWA language and time zone in Exchange for individuals, all users or per database.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question