ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage syntax / 
  • Default value
  • Adaptation to ANSI/Unicode
  • ANSI string
  • UNICODE string
  • Different types of strings
  • extension attribute
  • Notes
  • Default value
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The String type is used to manipulate strings. This type of variable is a string with a size defined dynamically.
The "string" type is specific to the WLanguage. With this type, there is no need to declare the length of the string. It can change when the variable is used.
The String type supports null values. For more details, see Allowing nullable types.
Remarks:
  • The Buffer type is also available. This type corresponds to a binary memory area. It allows you to write code for raw data manipulation, usable in both WINDEV and WINDEV Mobile.
  • For a variable of type String, TypeVar returns the wlString constant (value: 16).
  • A String variable can contain a single-line string, a multiline string or a dynamically built string including variables. For more details, see String literals.
Example
FirstName is string
FirstName = "Florence"
Syntax

Declaring and initializing a "String" variable Hide the details

<Variable name> is [ANSI] [UNICODE] string = <Value>
OR

<Variable name> is [ANSI] [UNICODE] string
<Variable name> = <Value>
<Variable name>:
Name of the variable to declare. When several variables of the same type are declared and initialized on the same line, only the last variable is initialized.
<ANSI>: Optional
Indicates that the string is an ANSI string. If this parameter is not specified, the string format will adapt to the format defined for the platform. For more details, see Adaptation to ANSI/Unicode.
<UNICODE>: Optional
Indicates that the string is a UNICODE string. If this parameter is not specified, the string format will adapt to the format defined for the platform. For more details, see Adaptation to ANSI/Unicode.
<Value>:
Value given to the variable.
Remarks

Default value

A declared and uninitialized "String" variable corresponds to an empty string ("").

Adaptation to ANSI/Unicode

  • WEBDEV - Server code If the current configuration uses ANSI strings at runtime, the String variables will be ANSI strings (default behavior).
  • WEBDEV - Server code If the current configuration uses UNICODE strings at runtime, the String variables will be UNICODE strings.
  • WEBDEV - Browser code This type of string is in UNICODE format.
Reminder: To change the string format in the current configuration:
  1. Open the project description window: on the "Project" tab, in the "Project" group, click "Description".
  2. In the "Project" tab, click "Configuration description".
  3. In the window that appears, go to the "Unicode" tab and select the desired mode.

ANSI string

Variable-length string containing ANSI characters only. This format is required to handle:
  • XML files,
  • RTF files,
  • PDF files,
  • functions that use UTF8 format, etc.

UNICODE string

Variable-length string containing UNICODE characters only.
WEBDEV - Server code In a configuration that uses ANSI strings at runtime, this type of string can be returned by AnsiToUnicode or by one of the functions for manipulating UNICODE strings.
For more details, see Unicode management.
WEBDEV - Server code This type of string is used by default if the current configuration uses UNICODE strings at runtime.
WEBDEV - Browser code This type of character string is not supported. It is replaced with the String type.
PHP This type of character string is not supported.

Different types of strings

WLanguage also offers the following string types:

<undetectable> extension attribute

The <undetectable> extension attribute obfuscates the value of a string stored in memory (for example, in a memory dump file).
By default, (if the <undetectable> extension attribute is not specified), all characters assigned to a String variable are visible in a memory dump file. These characters appear along with all the data in the dump file: this makes it impossible to determine what the string looks like, where it starts and where it ends.

The <undetectable> attribute obfuscates the value stored in memory. The value of the string cannot be determined based on the visible characters in the dump file.
This extension attribute is particularly useful to store a username or password in memory, to pass a password to HPass, or to connect to a database.
Example:
MyStringInMemory is string <undetectable>
MyStringInMemory = "Password"
Remarks:
  • Using the <undetectable> extension attribute can slow down the application. It should only be used on strings that require that attribute.
  • The <undetectable> extension attribute is not available for fixed-length strings.
Notes

Default value

  • A declared and uninitialized "String" variable corresponds to an empty string ("").
Related Examples:
Different types of strings Unit examples (WINDEV): Different types of strings
[ + ] Using the different types of strings available in WINDEV.
The specific features of each type are presented in details.
Types used:
- "Standard" string
- UNICODE string
- Fixed string
- Pascal String
- ASCIIZ String
- Buffer type
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 04/12/2024

Send a report | Local help