| | | 1 | | <div class="container"> |
| | | 2 | | <div class="row"> |
| | | 3 | | <div class="col"> |
| | | 4 | | |
| | | 5 | | <label class="label-control">Character:</label> |
| | | 6 | | <div class="input-group"> |
| | | 7 | | <input id="ascii" name="ascii" class="form-control" @bind="AsciiValue" placeholder="'" maxlength="1"> |
| | | 8 | | <span class="input-group-btn"> |
| | | 9 | | <button id="btnAscii" name="btnAscii" type="button" class="btn btn-success float-right" @onclick="Ge |
| | | 10 | | </span> |
| | | 11 | | </div> |
| | | 12 | | |
| | | 13 | | </div> |
| | | 14 | | </div> |
| | | 15 | | |
| | | 16 | | <br /> |
| | | 17 | | |
| | | 18 | | <div class="row"> |
| | | 19 | | <div class="col"> |
| | | 20 | | |
| | | 21 | | <table id="asciiItems"> |
| | | 22 | | <thead> |
| | | 23 | | <tr> |
| | | 24 | | <th>Char</th> |
| | | 25 | | <th>Dec</th> |
| | | 26 | | <th>Hex</th> |
| | | 27 | | <th>Oct</th> |
| | | 28 | | </tr> |
| | | 29 | | </thead> |
| | | 30 | | <tfoot></tfoot> |
| | | 31 | | <tbody> |
| | | 32 | | <tr> |
| | 0 | 33 | | <td>@Char</td> |
| | 0 | 34 | | <td>@Dec</td> |
| | 0 | 35 | | <td>@Hex</td> |
| | 0 | 36 | | <td>@Oct</td> |
| | | 37 | | </tr> |
| | | 38 | | </tbody> |
| | | 39 | | </table> |
| | | 40 | | |
| | | 41 | | </div> |
| | | 42 | | </div> |
| | | 43 | | |
| | | 44 | | <hr /> |
| | | 45 | | |
| | | 46 | | <div class="row"> |
| | | 47 | | <div class="col"> |
| | | 48 | | <p>Inspired from <a href="http://asciivalue.com/" target="_blank">ASCIIvalue</a></p> |
| | | 49 | | </div> |
| | | 50 | | </div> |
| | | 51 | | </div> |
| | | 52 | | |
| | | 53 | | @code { |
| | 0 | 54 | | string AsciiValue = "'"; |
| | 0 | 55 | | string Char = string.Empty; |
| | 0 | 56 | | string Dec = string.Empty; |
| | 0 | 57 | | string Hex = string.Empty; |
| | 0 | 58 | | string Oct = string.Empty; |
| | | 59 | | |
| | | 60 | | void GetAsciiValues() |
| | 0 | 61 | | { |
| | 0 | 62 | | char character = char.Parse(AsciiValue); |
| | | 63 | | |
| | 0 | 64 | | Char = AsciiValue; |
| | | 65 | | |
| | 0 | 66 | | int uiValue = (int)character; |
| | 0 | 67 | | Dec = uiValue.ToString(); |
| | | 68 | | |
| | 0 | 69 | | Hex = String.Concat(AsciiValue.Select(x => ((int)x).ToString("x2"))); |
| | | 70 | | |
| | | 71 | | // Oct = Convert.ToInt32(AsciiValue, 8).ToString(); // Could not find any recognizable digits. |
| | 0 | 72 | | Oct = Convert.ToString(character, 8); |
| | 0 | 73 | | } |
| | | 74 | | |
| | | 75 | | } |