How to find Article ID of Dotnetfunda?

Rajnilari2015
Posted by Rajnilari2015 under PowerShell category on | Points: 40 | Views : 260
In this code snippet we will look into how to find the article id of dotnetfunda using PowerShell

What is Article ID?

Let's say we have a URL as "http://www.dotnetfunda.com/articles/show/3158/import-xml-file-and-transform-into-relational-model-for-dynamic-column"
In this example, the value 3158 is the article ID

Code

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

In the $line = $string.Split($separator,$option) we are splitting the array.

And in the $line[$line.count..0][1] we are performing a reverse of the array and picking up the second element from the array collection which is 3158.

Comments or Responses

Login to post response