PowerTip: Use PowerShell to Get Length of a Number

Doctor Scripto

Summary:  Use Windows PowerShell to easily get the length of a number.

Hey, Scripting Guy! Question I want to know the length of a number, but when I use the Length property, it comes back as 1.
          How can I get the actual length?

Hey, Scripting Guy! Answer First convert the number to a string, and then get the length of the string:

(12345).tostring().length

0 comments

Discussion is closed.

Feedback usabilla icon