PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Using variables in a multiline string
  • Benefits of multiline strings that use the [] symbols
  • Limits
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Multiline strings
In french: Chaînes multi-lignes
WINDEV, WINDEV Mobile and WEBDEV include several tools allowing you to type character strings over several lines:
  • the [ and ] symbols
  • the triple dots (...)
Versions 16 and later
Universal Windows 10 App This feature is available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This feature is available for the Windows Phone applications.
Universal Windows 10 App This feature is available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This feature is available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This feature is available for the iPhone/iPad applications.
iPhone/iPad This feature is available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
New in version 18
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
Versions 21 and later
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
New in version 21
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
Example
// Using square brackets to type a multiline character string
MyString is string
MyString = [
Example of
multiline string
]
// Using triple dots to type a multiline character string
MyString is string
MyString = "Example of " + ...
"multiline string"
Syntax

Multiline string using the [ ] symbols Hide the details

<Variable Name> = [

                <Content of String>
                <Content of String 2>

                ]
<[>:
Symbol signaling the beginning of multiline string. This symbol must be followed by a carriage return. This carriage return is ignored in the string.
<Content of String>:
Multiline string, entered over several lines, without quote signs. The carriage returns found between 2 lines of the string are considered as being carriage returns. The tabulations are ignored.
<]>:
Symbol signaling the end of multiline string. This symbol must be preceded by a carriage return. This carriage return is ignored in the string.

Multiline string using the triple dots Hide the details

<Variable Name> = "<Content of String>"+ ...
                       "<Content of String 2>"
<Content of String>:
Multiline string, typed over several lines, with quotes. Each line is separated by + ...
Remarks

Using variables in a multiline string

To use a variable in a multiline string, you can:
  • interrupt the multiline string to take the variable into account.
    Example:
    sCode is string = ...
    "The string "+ ...
    sVar + ...
    " is multiline string"

    s is string = [
    the string
    ] + var + [
    is multiline
    ]

    This solution is not recommended if the character string must be translated.
  • use characters such as %1, %2, %n instead of configurable values and use StringBuild to replace the parameters found in the string by their values.
    Example:
    sCode is string = "The %1 string is a multiline string"
    sCode = StringBuild(sCode, MyVariable)

    sString is string = [
    the %1 string
    is multiline
    ]
    sString = StringBuild(sString, MyVariable)

    This last solution is recommended.

Benefits of multiline strings that use the [] symbols

  • Coloring the string: by default, the multiline character string is colored in purple (like any other string enclosed in quotes in WLanguage) and it is highlighted in mauve.
    The default colors of WLanguage can be used for the multiline string ("Coloring the string .. WLanguage" from the popup menu of multiline string). This option is used to check the code typed when a multiline string is used for the dynamic compilation (Compile).
  • Ability to collapse/expand a multiline string
    Collapsing the multiline strings is used to free space in the code editor. The code becomes clearer and more readable. When the string is collapsed, its content is displayed in a tooltip.

Limits

  • The maximum number of lines in a multiline string is set to 1000.
  • The multiline strings cannot contain any TAB characters (tabulation). Indeed, there is no way to differentiate between the tabulations found "in the string" and the indent tabulations of the code.
  • No multiline strings can be used inside multiline strings. The following code generates a WLanguage error:
    sCode is string = [
    sMultilineString is string = [
    Test on the multiline strings
    Attempt on the multiline strings
     ]
    ]
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment