12.1. The .NET String Class
Windows PowerShell text processing is founded on the .NET System.string class. As soon as you type in a string at the command line, you can access the methods and properties of the System.String class. For example, you can find the type of a string using this command:
"Hello world!".GetType()
You can also find the full name of the type using this command:
"Hello world!".GetType().FullName
Figure 12-1 shows the results of both commands. As you can see, the full name of the type of a string is System.String.
Figure 12.1. Figure 12-1
The result of the first command you typed uses Windows PowerShell's default formatter to display the result you see in Figure 12-1. If you had piped the output to the format-list cmdlet, you would get to see much more information about the type, as shown in Figure 12-2. That figure shows the first of several screens of information that tell you about the String type in the .NET 2.0 Framework. Notice that the FullName property is one of the many pieces of further information you can access about the object.
Figure 12.2. Figure 12-2
You can use Windows PowerShell to list the members of the String class. Knowing the methods of the System.String class allows you to explore what it is possible to do to the value of a string object. ...
Get Professional Windows® PowerShell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.