File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
tools/hex-converter/hex_converter Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,10 @@ Window {
8383 elide: Text .ElideRight
8484 }
8585
86+ onClicked: {
87+ input_chars_field .text = " "
88+ }
89+
8690 background: Rectangle {
8791 implicitWidth: 100
8892 implicitHeight: 40
@@ -102,6 +106,33 @@ Window {
102106 font .family : " ubuntu"
103107 font .pixelSize : 23
104108
109+ onClicked: {
110+ console .log (input_chars_field .text )
111+
112+ let input_str = input_chars_field .text
113+ let str_len = input_str .length
114+ let output_str = " "
115+
116+ for (let i= 0 ; i < str_len; i++ ) {
117+ let ch = input_str[i]
118+ if (ch !== ' string' || ch !== 1 ) {
119+ console .log (" Input must be a single character or string" )
120+ }
121+
122+ let unicode_value = ch .charCodeAt (0 )
123+ let hex_string = unicode_value .toString (16 )
124+
125+ /* append to output string */
126+ output_str += hex_string
127+ }
128+
129+ console .log (" HEX OUT: " + output_str)
130+
131+ /* display the text */
132+ output_chars_field .text = output_str
133+
134+ }
135+
105136 contentItem: Text {
106137 text: convert_button .text
107138 font: convert_button .font
You can’t perform that action at this time.
0 commit comments