Wednesday, January 12, 2011

How to generate ASCII Table

Very recently I get some request about ASCII code generate.
So that I share with this code...

using System;
using System.Web.UI;

public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("<table><tbody<tr>
<td>Decimal</td><td>ASCII character
</td><td>Hexadecimal</td></tr>\n");
int min = 0;
int max = 128;
for (int i = min; i <>// Get ascii character.
char c = (char)i;

// Get display string
string display = string.Empty;
if (char.IsWhiteSpace(c))
{
display = c.ToString();
switch (c)
{
case '\t':
display = "\\t";
break;
case ' ':
display = "space";
break;
case '\n':
display = "\\n";
break;
case '\r':
display = "\\r";
break;
case '\v':
display = "\\v";
break;
case '\f':
display = "\\f";
break;
}
}
else if (char.IsControl(c))
{
display = "control";
}
else
{
display = c.ToString();
}
// Write table row
Response.Write(string.Format("<tr><td>{0}</td>
<td>{1}</td><td>{0:X2}</td>
</tr>\n", i, display));
}
Response.Write("</tbody></table>");
}
}

No comments:

Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'

Exception: Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'...