Move getPrintableValue api to utils

This commit moves getPrintableValue api from VpdTool
class to utility file, as this is a common api needs to
be used by other class members as well.

Signed-off-by: Priyanga Ramasamy <priyanga24@in.ibm.com>
Change-Id: Iac8a645156d48c9f44308f96bf1f951b663a6669
diff --git a/ibm_vpd_utils.cpp b/ibm_vpd_utils.cpp
index 0d49a3f..bf50bd8 100644
--- a/ibm_vpd_utils.cpp
+++ b/ibm_vpd_utils.cpp
@@ -570,5 +570,39 @@
     return kwVal;
 }
 
+string getPrintableValue(const vector<unsigned char>& vec)
+{
+    string str{};
+    bool printableChar = true;
+    for (auto i : vec)
+    {
+        if (!isprint(i))
+        {
+            printableChar = false;
+            break;
+        }
+    }
+
+    if (!printableChar)
+    {
+        stringstream ss;
+        string hexRep = "0x";
+        ss << hexRep;
+        str = ss.str();
+
+        // convert Decimal to Hex
+        for (auto& v : vec)
+        {
+            ss << setfill('0') << setw(2) << hex << (int)v;
+            str = ss.str();
+        }
+    }
+    else
+    {
+        str = string(vec.begin(), vec.end());
+    }
+    return str;
+}
+
 } // namespace vpd
 } // namespace openpower
\ No newline at end of file