powerappsguide.com Open in urlscan Pro
45.58.159.44  Public Scan

URL: http://powerappsguide.com/blog/post/convert-character-to-ascii-code
Submission: On December 18 via manual from GB — Scanned from DE

Form analysis 1 forms found in the DOM

POST /Search

<form class="navbar-form" method="post" action="/Search">
  <div class="input-group">
    <input type="text" class="form-control zeroRadius" placeholder="Search" name="searchquery">
    <div class="input-group-btn">
      <button class="btn btn-default " style="margin-top:0;padding-top:6px;margin-bottom:0;padding-bottom:6px;"> Search </button>
    </div>
  </div>
</form>

Text Content

Power Apps Guide
 * Home
 * Book
 * Blog
 * Resources
 * About

Search


BLOG


TEXT - HOW TO CONVERT A CHARACTER TO ITS ASCII NUMERIC VALUE

November 28. 2021

There's no built-in function in Power Apps to convert a character to its ASCII
value. This post describes how to carry out this task.

With Power Apps, the Char function takes a numeric ASCII code and returns the
character representation.



http://powerappsguide.com/blog/post/how-to-use-char-function

Unfortunately, there's no built-in function to carry out the inverse of Char -
that is, a function that returns the numeric ASCII code for an input character.
It's useful to note that Excel VBA includes a function called ASC that carries
out this task, and app builders familiar with Excel often search for a Power
Apps equivalent.


To carry out this task, we need to write custom formula, and we can use the
structure that's shown below.




With({inputString:"a"},
    LookUp(
       ForAll(Sequence(255), 
              {Num:Value, Character:Char(Value)}
       ),
       Character=inputString
    ).Num        
)


We set inputString to the character to convert. As the screenshot beneath
illustrates, the formula returns the correct ASCII code for the input character
"a", which is 97.






HOW DOES THIS FORMULA WORK?


The formula applies the ForAll function to generate a table with 2 columns - the
numeric ASCII code and the corresponding character. The screenshot below
highlights the return value of this section of formula.






To retrieve the ASCII code that corresponds to a given input character, the
outer call to LookUp retrieves the numeric value for the target character value.



CONCLUSION

Power Apps provides no built-in function to convert an input character to an
ASCII code (ie, an Excel VBA ASC equivalent). This post described a formula to
carry out this task.

 *   Categories: 
 * text

Previous
 Text - Examples of how to use the Char function, and a reference of ASCII codes
Next
Dates - How to display or convert Excel date serial numbers  
Related posts
 * Text - How to truncate and add 3 dots / ellipsis to long label text
 * How to split the URL parameter name and values from a hyperlink
 * Numbers - How to Format Numbers with a Dollar Symbol the Right Way
 * Text - How to extract email addresses that are formatted with angle brackets
 * Text - The easiest way to copy text to the clipboard
 * Text - How to split input strings by carriage return followed by the colon
   character
 * Why doesn't the BeginWith, EndsWith, and Contains operators work as expected?


Please enable JavaScript to view thecomments powered by Disqus.

RECENT POSTS

 * Dynamics 365 and Power Platform User Group Q4 2024 meetup
 * Bug - What to do when setting a variable to Form.LastSubmit doesn't work
 * Datetime - Preventing user manipulation of the current time - how to retrieve
   a server date time value
 * Controls - How to set the date picker icon size - Workaround
 * Low Code No Code Microsoft Power Platform Conference 2024
 * Apps - The new easier way to open .msapp files 2024
 * Charts - A simple way to create better graphs and charts
 * Controls - How to workaround the bug when setting Radio Button fill color
   dynamically
 * Data - How to find the common rows from 3 or more collections
 * Editable Gallery - How to set a control value dynamically when a user changes
   the value of another control
 * Formula - How to rank times including joint times and ties
 * SQL Server - Grandfathered licensing model to end on October 1, 2024
 * Reading Dynamics 365 and Power Platform User Group successfully holds its Q3
   2024 meetup
 * Bug - How to fix problem with the advanced section of the properties pane
   appearing blank
 * What happened at the Power Apps track at the Low Code Power Summit 2024?
 * Designer - The upcoming ability to copy and paste source code from the
   designer will be a fantastic enhancement
 * Error - Diagnosing the error "Network error when using the Patch function"
   when saving data with a form
 * Apps - How to add predefined stock background images

BLOG AUTHOR

Tim Leung
Author, software developer,
Power Platform specialist

BLOG CATEGORIES

 * General Info
 * * Beginners Guide
   * Subscribing
   * Sample Apps
 * Data
 * * SQL Server
   * Delegation
   * Excel
   * SharePoint
   * Dataverse
 * Formulas
 * * Patch
   * Sums/Totals
   * Search/Filter
   * Dates/Times
   * Variables
 * Screen Design
 * * Controls
   * Forms

© 2021 - Tim Leung. No affiliation with Microsoft Corporation is intended or
implied.

Extra small devices Portrait phones ( < 544 px)
Small devices Landscape phones ( 544px - 768px)
Medium devices Tablets (768px - 992px)
Large devices Desktops (992px - 1200px)
Extra large devices Desktops ( 1200px)