Co8572ToString_ifp.GetUnicodeString C# (CSharp) Method

GetUnicodeString() static private method

static private GetUnicodeString ( String str ) : String
str String
return String
 static String GetUnicodeString(String str) 
   {
   StringBuilder buffer = new StringBuilder();
   for (int i = 0; i < str.Length; i++) 
     {
     if (str[i] < 0x20) 
       {
       buffer.Append("\\x" + ((int)str[i]).ToString("x4"));
       } 
     else if (str[i] < 0x7f) 
       {
       buffer.Append(str[i]);
       } 
     else 
       {
       buffer.Append("\\x" + ((int)str[i]).ToString("x4"));
       }
     }
   return (buffer.ToString());
   }
}