Print array elements in reverse order using Powershell

Rajnilari2015
Posted by Rajnilari2015 under PowerShell category on | Points: 40 | Views : 4126
Suppose we have a string as under

"http://www.dotnetfunda.com/articles/show/3158/import-xml-file-and-transform-into-relational-model-for-dynamic-column"

We want to split and print the elements in reverse order using PowerShell

$string = "http://www.dotnetfunda.com/articles/show/3158/import-xml-file-and-transform-into-relational-model-for-dynamic-column"
$separator = "/"
$option = [System.StringSplitOptions]::RemoveEmptyEntries
$splitArray = $string.Split($separator,$option)
$splitArray[$splitArray.count..0]


We are splitting the string into array elements and then performing a reverse loop.

Result
import-xml-file-and-transform-into-relational-model-for-dynamic-column
3158
show
articles
www.dotnetfunda.com
http:

Comments or Responses

Login to post response