|
1 |
| ---- |
2 |
| -title: Char function | Microsoft Docs |
3 |
| -description: Reference information for the Char function in Power Apps, including syntax and examples |
4 |
| -author: gregli-msft |
5 |
| -manager: kvivek |
6 |
| -ms.service: powerapps |
7 |
| -ms.topic: reference |
8 |
| -ms.custom: canvas |
9 |
| -ms.reviewer: tapanm |
10 |
| -ms.date: 07/17/2020 |
11 |
| -ms.author: gregli |
12 |
| -search.audienceType: |
13 |
| - - maker |
14 |
| -search.app: |
15 |
| - - PowerApps |
16 |
| ---- |
17 |
| -# Char function in Power Apps |
18 |
| - |
19 |
| -Translates a character code into a string. |
20 |
| - |
21 |
| -## Description |
22 |
| - |
23 |
| -The **Char** function translates a number into a string with the corresponding ASCII character. |
24 |
| - |
25 |
| -## Syntax |
26 |
| - |
27 |
| -**Char**( *CharacterCode* ) |
28 |
| - |
29 |
| -- *CharacterCode* - Required. ASCII character code to translate. |
30 |
| - |
31 |
| -## Examples |
32 |
| - |
33 |
| -| Formula | Description | Result | |
34 |
| -| --- | --- | --- | |
35 |
| -| **Char( 65 )** |Returns the character that corresponds to ASCII code 65. |"A" | |
36 |
| -| **Char( 105 )** |Returns the character that corresponds to ASCII code 105. |"i" | |
37 |
| -| **Char( 35 )** |Returns the character that corresponds to ASCII code 35. |"#" | |
38 |
| - |
39 |
| -### Display a character map |
40 |
| - |
41 |
| -1. On an empty screen in a tablet app, add a [**Gallery**](../controls/control-gallery.md) control with a **Blank Horizontal** layout, and then set these properties: |
42 |
| - |
43 |
| - - **Items**: `Sequence( 8, 0, 16 ) As HighNibble` |
44 |
| - - **Width**: `Parent.Width` |
45 |
| - - **Height**: `Parent.Height` |
46 |
| - - **TemplateSize**: `Parent.Width / 8` |
| 1 | +--- |
| 2 | +title: Char function | Microsoft Docs |
| 3 | +description: Reference information for the Char function in Power Apps, including syntax and examples |
| 4 | +author: gregli-msft |
| 5 | +manager: kvivek |
| 6 | +ms.service: powerapps |
| 7 | +ms.topic: reference |
| 8 | +ms.custom: canvas |
| 9 | +ms.reviewer: tapanm |
| 10 | +ms.date: 07/17/2020 |
| 11 | +ms.author: gregli |
| 12 | +search.audienceType: |
| 13 | + - maker |
| 14 | +search.app: |
| 15 | + - PowerApps |
| 16 | +--- |
| 17 | +# Char function in Power Apps |
| 18 | + |
| 19 | +Translates a character code into a string. |
| 20 | + |
| 21 | +## Description |
| 22 | + |
| 23 | +The **Char** function translates a number into a string with the corresponding ASCII character. |
| 24 | + |
| 25 | +## Syntax |
| 26 | + |
| 27 | +**Char**( *CharacterCode* ) |
| 28 | + |
| 29 | +- *CharacterCode* - Required. ASCII character code to translate. |
| 30 | + |
| 31 | +## Examples |
| 32 | + |
| 33 | +| Formula | Description | Result | |
| 34 | +| --- | --- | --- | |
| 35 | +| **Char( 65 )** |Returns the character that corresponds to ASCII code 65. |"A" | |
| 36 | +| **Char( 105 )** |Returns the character that corresponds to ASCII code 105. |"i" | |
| 37 | +| **Char( 35 )** |Returns the character that corresponds to ASCII code 35. |"#" | |
| 38 | + |
| 39 | +### Display a character map |
| 40 | + |
| 41 | +1. On an empty screen in a tablet app, add a [**Gallery**](../controls/control-gallery.md) control with a **Blank Horizontal** layout, and then set these properties: |
| 42 | + |
| 43 | + - **Items**: `Sequence( 8, 0, 16 ) As HighNibble` |
| 44 | + - **Width**: `Parent.Width` |
| 45 | + - **Height**: `Parent.Height` |
| 46 | + - **TemplateSize**: `Parent.Width / 8` |
47 | 47 | - **TemplatePadding**: 0
|
48 | 48 | - **X**: 0
|
49 | 49 | - **Y**: 0
|
50 |
| - |
51 |
| -1. Inside that gallery, add a **Gallery** control with a **Blank Vertical** layout, and then set these properties: |
52 |
| - |
53 |
| - - **Items**: `Sequence( 16, HighNibble.Value ) As FullCode` |
54 |
| - - **Width**: `Parent.Width / 8` |
55 |
| - - **Height**: `Parent.Height` |
56 |
| - - **TemplateSize**: `Parent.Height / 16` |
| 50 | + |
| 51 | +1. Inside that gallery, add a **Gallery** control with a **Blank Vertical** layout, and then set these properties: |
| 52 | + |
| 53 | + - **Items**: `Sequence( 16, HighNibble.Value ) As FullCode` |
| 54 | + - **Width**: `Parent.Width / 8` |
| 55 | + - **Height**: `Parent.Height` |
| 56 | + - **TemplateSize**: `Parent.Height / 16` |
57 | 57 | - **TemplatePadding**: 0
|
58 | 58 | - **X**: 0
|
59 |
| - - **Y**: 0 |
60 |
| - |
61 |
| -1. Inside the second (vertical) gallery, add a **Label** control, and set these properties: |
62 |
| - |
63 |
| - - **Text**: `FullCode.Value` |
| 59 | + - **Y**: 0 |
| 60 | + |
| 61 | +1. Inside the second (vertical) gallery, add a **Label** control, and set these properties: |
| 62 | + |
| 63 | + - **Text**: `FullCode.Value` |
64 | 64 | - **Width**: `Parent.Width / 2`
|
65 | 65 | - **X**: 0
|
66 | 66 | - **Y**: 0
|
67 | 67 | - **Align**: `Center`
|
68 | 68 | - **FontWeight**: `Bold`
|
69 |
| - - **Size**: 24 |
70 |
| - |
71 |
| -1. Inside the second (vertical) gallery, add another **Label** control, and set these properties: |
72 |
| - |
73 |
| - - **Text**: `Char( FullCode.Value )` |
74 |
| - - **Width**: `Parent.Width / 2` |
| 69 | + - **Size**: 24 |
| 70 | + |
| 71 | +1. Inside the second (vertical) gallery, add another **Label** control, and set these properties: |
| 72 | + |
| 73 | + - **Text**: `Char( FullCode.Value )` |
| 74 | + - **Width**: `Parent.Width / 2` |
75 | 75 | - **X**: `Parent.Width / 2`
|
76 | 76 | - **Y**: 0
|
77 | 77 | - **FontWeight**: `Bold`
|
78 |
| - - **Size**: 24 |
79 |
| - |
80 |
| -You've created a chart of the first 128 ASCII characters. Characters that appear as a small square can't be printed. |
81 |
| - |
82 |
| - |
83 |
| - |
84 |
| -What is going on here? Let's see how **FullCode.Value** gets its values. Let's begin with the outer horizontal gallery. Its **Items** property uses the **Sequence** function to create 8 columns, starting with 0 with increments of 16: |
85 |
| - |
86 |
| - |
87 |
| - |
88 |
| -Nested within this gallery is another vertical gallery. Its **Items** property fills in the gap left by the increment of 16 from the outer gallery: |
89 |
| - |
90 |
| - |
91 |
| - |
92 |
| -To show the extended ASCII characters, it is a simple matter of changing the starting point for the chart, set in the Sequence function for the outer gallery: |
93 |
| - |
94 |
| -`Sequence( 8, 128, 16 ) As HighNibble` |
95 |
| - |
96 |
| - |
97 |
| - |
98 |
| -Finally, to show the characters in a different font, set the **Font** property of the second label to a value such as **'Dancing Script'**. |
99 |
| - |
100 |
| - |
| 78 | + - **Size**: 24 |
| 79 | + |
| 80 | +You've created a chart of the first 128 ASCII characters. Characters that appear as a small square can't be printed. |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +If you want to see how **FullCode.Value** gets its values. Let's begin with the outer horizontal gallery. Its **Items** property uses the **Sequence** function to create 8 columns, starting with 0 with increments of 16: |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +Nested within this gallery is another vertical gallery. Its **Items** property fills in the gap left by the increment of 16 from the outer gallery: |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +To show the extended ASCII characters, it is a simple matter of changing the starting point for the chart, set in the Sequence function for the outer gallery: |
| 93 | + |
| 94 | +`Sequence( 8, 128, 16 ) As HighNibble` |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | +Finally, to show the characters in a different font, set the **Font** property of the second label to a value such as **'Dancing Script'**. |
| 99 | + |
| 100 | + |
0 commit comments