diff options
Diffstat (limited to 'kommander/examples/tutorial/strings.kmdr')
-rw-r--r-- | kommander/examples/tutorial/strings.kmdr | 206 |
1 files changed, 206 insertions, 0 deletions
diff --git a/kommander/examples/tutorial/strings.kmdr b/kommander/examples/tutorial/strings.kmdr new file mode 100644 index 00000000..1ef6a953 --- /dev/null +++ b/kommander/examples/tutorial/strings.kmdr @@ -0,0 +1,206 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>Form1</class> +<widget class="Dialog"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>522</width> + <height>447</height> + </rect> + </property> + <property name="caption"> + <string>String functions</string> + </property> + <property name="associations" stdset="0"> + <stringlist> + <string></string> + <string></string> + <string></string> + </stringlist> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TextEdit" row="1" column="0"> + <property name="name"> + <cstring>TextEdit1</cstring> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="populationText"> + <string>@Array.setValue(Bool, 1, yes) +@Array.setValue(Bool, 0, no) + +<h2>Kommander string functions</h2> +<b>Length:</b> @String.length("@LineEdit1")<br> +<b>First 5 chars:</b> @String.left("@LineEdit1", 5)<br> +<b>Last 5 chars:</b> @String.right("@LineEdit1", 5)<br> +<b>Chars from 6th to 10th:</b> @String.mid("@LineEdit1", 6, 5)<br> +<b>Remove spaces:</b> @String.remove("@LineEdit1", " ")<br> +<b>Replace spaces with *</b>: @String.replace("@LineEdit1", " ", *)<br> +<b>Uppercase:</b> @String.upper("@LineEdit1")<br> +<b>Lowercase:</b> @String.lower("@LineEdit1")<br> +<b>Is a number?:</b> @Array.value(Bool, @String.isNumber("@LineEdit1"))<br> +<b>Is empty?</b> @Array.value(Bool, @String.isEmpty("@LineEdit1"))<br> +<b>Contains "Kommander"?:</b> @String.contains("@LineEdit1", "Kommander")<br> +<b>Position of "Kommander":</b> @String.find("@LineEdit1", "Kommander")<br> +<b>Compare with "Kommander":</b> +@execBegin +if [ @String.compare("@LineEdit1", "Kommander") -lt 0 ];then + echo "Less than Kommander<br>" +elif [ @String.compare("@LineEdit1", "Kommander") -gt 0 ];then + echo "Greater than Kommander <br>" +elif [ @String.compare("@LineEdit1", "Kommander") -eq 0 ];then + echo "Equals Kommander <br>" +fi +@execEnd +<b>Case insensitive match with "Kommander":</b> +@execBegin +if [ @String.compare(@String.lower("@LineEdit1"), "kommander") -eq 0 ];then + echo "Match found<br>" +else + echo "Match failed<br>" +fi +@execEnd</string> + </property> + <property name="associations" stdset="0"> + <stringlist> + <string></string> + </stringlist> + </property> + </widget> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Enter str&ing here:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>LineEdit1</cstring> + </property> + </widget> + <widget class="LineEdit"> + <property name="name"> + <cstring>LineEdit1</cstring> + </property> + <property name="text"> + <string>I love Kommander!</string> + </property> + <property name="associations" stdset="0"> + <stringlist> + <string>@widgetText</string> + </stringlist> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>Layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="ExecButton"> + <property name="name"> + <cstring>ExecButton1</cstring> + </property> + <property name="text"> + <string>&Test</string> + </property> + <property name="populationText"> + <string></string> + </property> + <property name="associations" stdset="0"> + <stringlist> + <string></string> + </stringlist> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>ExecButton1</sender> + <signal>clicked()</signal> + <receiver>TextEdit1</receiver> + <slot>populate()</slot> + </connection> +</connections> +<tabstops> + <tabstop>LineEdit1</tabstop> + <tabstop>ExecButton1</tabstop> + <tabstop>TextEdit1</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> |