{"id":6864,"date":"2020-03-02T21:53:29","date_gmt":"2020-03-02T20:53:29","guid":{"rendered":"https:\/\/michlstechblog.info\/blog\/?p=6864"},"modified":"2020-03-03T13:05:33","modified_gmt":"2020-03-03T12:05:33","slug":"powershell-convert-hex-to-int-type","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/powershell-convert-hex-to-int-type\/","title":{"rendered":"Powershell: Convert Hex to Int type"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_6864 social_share_privacy clearfix 1.6.4 locale-en_US sprite-en_US\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_6864')){$('.twoclick_social_bookmarks_post_6864').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"Powershell%3A%20Convert%20Hex%20to%20Int%20type\",\"the_excerpt\":\"Hi%2C%0D%0A%0D%0Ashort%20post%20today.%20Topic%3A%20convert%20a%20hex%20string%20to%20an%20integer%20type.%0D%0A%20%28more%26hellip%3B%29\",\"txt_info\":\"2 clicks for more data protection:\\r\\n\\r\\nOnly when you click here, the button will be come active and you can send your recommendation to Flattr. When activating, data are transmitted to third parties. \",\"perma_option\":\"off\"}},\"txt_help\":\"When you activate these fields by clicking, information to Flattr may be transferred abroad, and probably may also stored there.\",\"settings_perma\":\"Enable permanently and accept data transmission. \",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/michlstechblog.info\\\/blog\\\/powershell-convert-hex-to-int-type\\\/\",\"post_id\":6864,\"post_title_referrer_track\":\"Powershell%3A+Convert+Hex+to+Int+type\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>Hi,<\/p>\n<p>short post today. Topic: convert a hex string to an integer type.<br \/>\n<!--more--><br \/>\nThis can be done by a simple cast. Consider to use try\/catch to handle any exceptions.<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n$sMyHexValue=&quot;0xff&quot;\r\n$iInt=&#x5B;Int32]$sMyHexValue\r\nwrite-host &quot;HexString:&quot; $sMyHexValue  &quot;HexFormatedFromInt&quot; (&#x5B;string]::Format(&quot;0x{0:x}&quot;,$iInt)) &quot;Int:&quot; $iInt\r\nHexString: 0xff HexFormatedFromInt 0xff Int: 255\r\n<\/pre>\n<p>Michael<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, short post today. Topic: convert a hex string to an integer type.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[344,5],"tags":[450,1380,971,1416,1417,133],"class_list":["post-6864","post","type-post","status-publish","format-standard","hentry","category-powershell-scripting","category-windowsknowhow","tag-convert","tag-format","tag-hex","tag-integer","tag-output","tag-powershell"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/6864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/comments?post=6864"}],"version-history":[{"count":3,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/6864\/revisions"}],"predecessor-version":[{"id":6867,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/6864\/revisions\/6867"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=6864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=6864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=6864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}