Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - string.format() ???

Reply
 
Old 05-19-2006   #1 (permalink)
Jeff Jarrell


 
 

string.format() ???

is there a way to get to string.format?

I notice when I do a get-member it isn't exposed.



My System SpecsSystem Spec
Old 05-20-2006   #2 (permalink)
Bruce Payette [MSFT]


 
 

Re: string.format() ???

Static methods require the '::' operator instead of:

PS (52) > [string]::format("Hi {0}", "there")
Hi there

You may also want to look at the format operator -f which is effectively
short-hand for String.Format:

PS (53) > "Hello {0}, today is {1}" -f "there",(get-date)
Hello there, today is 5/19/2006 10:16:03 PM

-bruce

--
Bruce Payette [MSFT]
Windows PowerShell Technical Lead
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jeff Jarrell" <jjarrel_NOSPAM@yahoo.com> wrote in message
news:uezL1X7eGHA.2172@TK2MSFTNGP04.phx.gbl...
> is there a way to get to string.format?
>
> I notice when I do a get-member it isn't exposed.
>



My System SpecsSystem Spec
Old 05-20-2006   #3 (permalink)
Jeff Jarrell


 
 

Re: string.format() ???

thats it, thanks.
jeff

"Bruce Payette [MSFT]" <brucepay@microsoft.com> wrote in message
news:%23Az$3y8eGHA.4828@TK2MSFTNGP05.phx.gbl...
> Static methods require the '::' operator instead of:
>
> PS (52) > [string]::format("Hi {0}", "there")
> Hi there
>
> You may also want to look at the format operator -f which is effectively
> short-hand for String.Format:
>
> PS (53) > "Hello {0}, today is {1}" -f "there",(get-date)
> Hello there, today is 5/19/2006 10:16:03 PM
>
> -bruce
>
> --
> Bruce Payette [MSFT]
> Windows PowerShell Technical Lead
> Microsoft Corporation
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> "Jeff Jarrell" <jjarrel_NOSPAM@yahoo.com> wrote in message
> news:uezL1X7eGHA.2172@TK2MSFTNGP04.phx.gbl...
>> is there a way to get to string.format?
>>
>> I notice when I do a get-member it isn't exposed.
>>

>
>



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
String format strange behaviour .NET General
Converting date time format to string format PowerShell
Format a string with non printable chars PowerShell
RE: Format a string with non printable chars PowerShell
ADO and String.Format questions. PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46