Tuto WEBDEV 25
Part 13: The WLanguage basics 437 ▶ Let’s now run the page test: 1. Click among the quick access buttons (or press F9). 2. The window that was just modified is automatically saved then it is started in execution. Click on the button. The WEBDEV word is found. 3. Modify the content of edit control (by replacing WEBDEV by WB for example) and click the button. The WEBDEV word is not found. 4. Close the browser. Comparing two strings ▶ To create the "Compare two strings" Button control: 1. On the "Creation" pane, in the "Usual controls" group, click . 2. Click the location where the Button control will be created (for example, to the right of the existing Button control). 3. Click the control that was just created. The text displayed in the control becomes editable. Type the caption: "Compare two strings". 4. Press Enter to validate the input. 5. Adapt the control size. 6. Display the events associated with the Button control (press F2). 7. Write the following code in the event "Click on (Server)": sStringToCompare is string = "WEBDEV" IF EDT_Text ~= sStringToCompare THEN Info("The displayed text corresponds to " + sStringToCompare) ELSE Info("The displayed text does not correspond to " + sStringToCom pare) END Let’s study this code: • A String variable is declared. This variable contains the string to compare. • The ~= operator corresponds to a flexible equality. This operator is used to perform a comparison while ignoring the case, the spaces found before and after the string and the accented characters. Remark : to type the "~" sign, press AltGr + 2. • If the comparison is true, the edit control corresponds to the word found in the string to compare regardless of the case used.
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==