![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Select first 16 characters in a string I need to figure out how to take a string and pick out the first 16 characters of that string to be used in a pattern match later. Anyone have any suggestions on how to select a certain number of characters (digits, letters, and even white space)? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Select first 16 characters in a string Actually figured it out for myself for once (how bout that). <string> -match '.{1,16}' Steven wrote: Quote: > I need to figure out how to take a string and pick out the first 16 > characters of that string to be used in a pattern match later. Anyone > have any suggestions on how to select a certain number of characters > (digits, letters, and even white space)? |
My System Specs![]() |
| | #3 (permalink) |
| | RE: Select first 16 characters in a string You can use the substring method on a string. 63# "sixteen character string".Substring(0,16) sixteen characte -paul "Steven" wrote: Quote: > I need to figure out how to take a string and pick out the first 16 > characters of that string to be used in a pattern match later. Anyone > have any suggestions on how to select a certain number of characters > (digits, letters, and even white space)? > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Select first 16 characters in a string PS > $s = "abcdefghijklmnopqrstuvwxyz" PS > $s[0..15] a b c d e f g h i j k l m n o p --- Shay Levy Windows PowerShell MVP http://blogs.microsoft.co.il/blogs/ScriptFanatic PowerShell Toolbar: http://tinyurl.com/PSToolbar S> I need to figure out how to take a string and pick out the first 16 S> characters of that string to be used in a pattern match later. S> Anyone have any suggestions on how to select a certain number of S> characters (digits, letters, and even white space)? S> |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Select first 16 characters in a string Based on your initial question, I would have thought this link a better match: http://www.microsoft.com/technet/scr...vert/left.mspx $a="ABCDEFGHIJKLMNOPQRSTUVWXYZ" $a = $a.substring(0,16) Steven Peck http://www.blkmtn.org/powershell "Steven" wrote: Quote: > Actually figured it out for myself for once (how bout that). > > <string> -match '.{1,16}' > > Steven wrote: Quote: > > I need to figure out how to take a string and pick out the first 16 > > characters of that string to be used in a pattern match later. Anyone > > have any suggestions on how to select a certain number of characters > > (digits, letters, and even white space)? |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Remove characters in a string | VB Script | |||
| How to Randomize characters in a string | VB Script | |||
| Replacing Multiple Characters In A String | PowerShell | |||
| problems with $var | select-string -pattern $string -q | PowerShell | |||
| Removing characters from a string | PowerShell | |||