Looking for help?
-
Getting Started
-
Install and Launch ADE
-
System Menu
-
Font Management
-
Toolbars
-
HMI Design Flow
-
Page
-
Widget Properties
-
- Name
- Checkbox
- Drop down list
- Plain Text
- Number Editor
- Font Selector
- Color Selector
- Alignment Selector
- Page Selector
- Register Selector
- Register Operation Setting
- Block Editor
- Image Collection Management
- Visibility Control
- Blending Mode Selector
- Open File Dialog Box
- Image Editor Dialog Box
- PlainTextArray Table Dialog
- Format String
- Label Display Mode
- Frame Selector
- Input Data Selector
- MessageBox Selector
- FileArray Table Dialog
- Event Setting
- Show Remaining Articles (10) Collapse Articles
-
-
Widgets
-
- Slider Switch
- Click Button
- Press/Release Button
- Momentary Push Button
- Generic Push Button
- Generic Latching Button
- Generic Button
- Multiple State Button
- Image List
- Animation
- Scrolling Label
- Date/Time Label
- Image Label
- Digits
- Circular Progress Bar
- Circular Meter
- Generic Progress Bar
- Horizontal Slider
- Vertical Slider
- Touch Area
- Bitmap Image
- Rotation Image
- Data Chart
- Generic Gauge
- Circular Scale
- Circular Gauge
- LED
- Palette
- Flexible Label
- Show Remaining Articles (14) Collapse Articles
-
< All Topics
Print
Format String
PostedMarch 18, 2024
UpdatedMarch 18, 2024
Byadminrdk
Views2
String Format
ADE adopt Python’s string format for converting variable in a string to a numerical number.
Please use “{ }” and “:” to replace “%”.
| Format | Description | Number | Output |
|---|---|---|---|
| {:d} | Decimal Integer | 200 | 200 |
| {:x} | Hexadecimal Integer, lower case | 200 | c8 |
| {:X} | Hexadecimal Integer, upper case | 200 | C8 |
| {:>10d} | Number of digits is set to 10, aligned to the right | 2 | 2 |
| {:<10d} | Number of digits is set to 10, aligned to the left | 2 | 2 |
| {:^10d} | Number of digits is set to 1o, aligned to center | 2 | 2 |
| {:0>2d} {:02} | Number of digits is set to 2, 0 is inserted to the left if not enough digits | 5 | 05 |
| {:x>2d} | Number of digits is set to 2, x is inserted to the left if not enough digits | 5 | x5 |
| {:x<2d} | Number of digits is set to 2, x is serted to the right if not enough digits | 5 | 5x |
| {:f} | Float Point | 3.1415926 | 3.1415926 |
| {:.0f} | Integer | 3.1415926 | 3 |
| {:.2f} | Two digits behind the decimal point preserved | 3.1415926 | 3.14 |
| {:+.2f} | Signed with two digits behind the decimal point preserved | 3.1415926 | +3.14 |
| {:,} | Thousands digit comma | 1000000 | 1,000,000 |
| {:.0%} | Percentage | 0.33333 | 33% |
| {:.2%} | Percentage with two digits behind the decimal point preserved | 0.33333 | 33.33% |
| {:s} | Use str() for converting to a string | ‘hello’ | hello |
Please refer to: https://docs.python.org/2/library/stdtypes.html#string-formatting-operations
Table of Contents
