get-clipboard and string arrays

Topics: User Forum
Apr 4, 2008 at 3:41 PM
If clipboard data is a few (vertical) cells in Excel, the clipboard object returned by get-clipboard is a single multi-lined string. I would much rather have that as an array of strings. In fact, 99% of the time that's what I am going to want. Is it possible to get a flag added to it to split on newlines so that I don't have to? This function does the trick but I'd rather not need it.

function Get-ClipboardArray {
$clip = Get-Clipboard -Text
if ( $clip ) { $clip.split("`n") }
Apr 7, 2008 at 4:50 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.