<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Is there a function to convert a character to its ASCII equivalent? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Is-there-a-function-to-convert-a-character-to-its-ASCII/m-p/482841#M72717</link>
    <description>&lt;P&gt;Is there a function to conver a character to an ascii number?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the end I need to translate a character based column in data into its numerical equivalent.&amp;nbsp; They always happen to be 1 or 2 digits.&amp;nbsp; So effectively&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"A" becomes 1&lt;/P&gt;&lt;P&gt;"Z" becomes 26&lt;/P&gt;&lt;P&gt;"AA" becomes 27&lt;/P&gt;&lt;P&gt;"AB" becomes 28&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So say DIE_COLUMN = "CA"&amp;nbsp; I want to return 79&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've come up with the following thoroughly ugly formula... but if there was a char to ascii function I could do a lot better.&amp;nbsp; &amp;nbsp;There HAS to be a cleaner way.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Length( :DIE_COLUMN ) == 2,
	Contains( "ABCDEFGHIJKLMNOPQRSTUVWXYZ", Left( :DIE_COLUMN, 1 ) ) * 26,
	0
) + Contains( "ABCDEFGHIJKLMNOPQRSTUVWXYZ", Right( :DIE_COLUMN, 1 ) )&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 Jun 2023 16:57:56 GMT</pubDate>
    <dc:creator>LikelihoodFaces</dc:creator>
    <dc:date>2023-06-09T16:57:56Z</dc:date>
    <item>
      <title>Is there a function to convert a character to its ASCII equivalent?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-function-to-convert-a-character-to-its-ASCII/m-p/482841#M72717</link>
      <description>&lt;P&gt;Is there a function to conver a character to an ascii number?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the end I need to translate a character based column in data into its numerical equivalent.&amp;nbsp; They always happen to be 1 or 2 digits.&amp;nbsp; So effectively&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"A" becomes 1&lt;/P&gt;&lt;P&gt;"Z" becomes 26&lt;/P&gt;&lt;P&gt;"AA" becomes 27&lt;/P&gt;&lt;P&gt;"AB" becomes 28&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So say DIE_COLUMN = "CA"&amp;nbsp; I want to return 79&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've come up with the following thoroughly ugly formula... but if there was a char to ascii function I could do a lot better.&amp;nbsp; &amp;nbsp;There HAS to be a cleaner way.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Length( :DIE_COLUMN ) == 2,
	Contains( "ABCDEFGHIJKLMNOPQRSTUVWXYZ", Left( :DIE_COLUMN, 1 ) ) * 26,
	0
) + Contains( "ABCDEFGHIJKLMNOPQRSTUVWXYZ", Right( :DIE_COLUMN, 1 ) )&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:57:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-function-to-convert-a-character-to-its-ASCII/m-p/482841#M72717</guid>
      <dc:creator>LikelihoodFaces</dc:creator>
      <dc:date>2023-06-09T16:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a function to convert a character to its ASCII equivalent?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-function-to-convert-a-character-to-its-ASCII/m-p/482894#M72721</link>
      <description>&lt;P&gt;For the translation you are doing, your function works.&amp;nbsp; If an ASCII to Decimal function was used, the character "A" would return 65&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1651162823000.png" style="width: 824px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/42099i4F51BA46F61A4E88/image-dimensions/824x542?v=v2" width="824" height="542" role="button" title="txnelson_0-1651162823000.png" alt="txnelson_0-1651162823000.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 16:21:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-function-to-convert-a-character-to-its-ASCII/m-p/482894#M72721</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-04-28T16:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a function to convert a character to its ASCII equivalent?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-function-to-convert-a-character-to-its-ASCII/m-p/482916#M72722</link>
      <description>Translating 2 character codes to a number is a good job for an associative array. You could create the aa with nested for loops. You might want to force lower case on the keys .</description>
      <pubDate>Thu, 28 Apr 2022 16:45:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-function-to-convert-a-character-to-its-ASCII/m-p/482916#M72722</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2022-04-28T16:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a function to convert a character to its ASCII equivalent?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-function-to-convert-a-character-to-its-ASCII/m-p/482930#M72725</link>
      <description>&lt;P&gt;This will do it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;die_column = "CA";
If( Length( DIE_COLUMN ) == 2,
	(num(hex(Left( DIE_COLUMN, 1 ) )) - 40) * 26,
	0
) + num(hex(Right( DIE_COLUMN, 1 ) )) - 40&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You would need to uppercase die_column.&amp;nbsp; This works because A is ASCII 41.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 18:36:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-function-to-convert-a-character-to-its-ASCII/m-p/482930#M72725</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2022-04-28T18:36:47Z</dc:date>
    </item>
  </channel>
</rss>

