4D v14.3

C_STRING

Home

 
4D v14.3
C_STRING

C_STRING 


 

C_STRING ( {method ;} size ; variable {; variable2 ; ... ; variableN} ) 
Parameter Type   Description
method  Method in Nom de méthode
size  Longint in Size of the string
variable  Variable in Name of variable(s) to declare

The C_STRING command casts each specified variable as a String variable.

The size parameter specifies the maximum length of the strings that the variable can contain. In non-Unicode mode (ASCII compatibility), strings are limited to 255 characters. If speed is a concern, use string variables rather than text variables wherever possible.

Compatibility Note: Databases created beginning with version 11 of 4D are executed by default in Unicode mode (see the ASCII Codes section). In this mode, the functioning of the C_STRING command is strictly identical to that of the C_TEXT command (the size parameter is ignored). It is recommended to use C_TEXT in new developments. The C_STRING command is kept only for reasons of compatibility.

The first form of the command, in which the optional method parameter is NOT passed, is used to declare and type any process, interprocess, or local variable.

Note: This form can be used in interpreted databases.

The second form of the command, in which the optional method parameter IS passed, is used to predeclare to the compiler the result and/or the parameters ($0, $1, $2 etc) for a method. Use this form of the command in order to skip the Typing variables phase while compiling a database, saving compilation time.

WARNING: The second form cannot be executed in interpreted mode. For this reason, if you are using this syntax, keep it in a method that is not executed in interpreted mode. The name of this method must start with “COMPILER.”

Advanced Tip: The syntax C_STRING(...;${...}) allows you to declare a variable number of parameters of the same type, under the condition that these are the last parameters for the method. For example, the declaration C_STRING(...;${5}) tells 4D and the compiler that starting with the fifth parameter, the method can receive a variable number of parameters of that type. For more information, see the Count parameters command.

See examples in the section Compiler Commands.

 
PROPERTIES 

Product: 4D
Theme: Compiler
Number: 293

This command is deprecated and should not be used anymore

 
HISTORY 

Modified: 4D v11 SQL

 
SEE ALSO 

C_TEXT
Compiler Commands
Count parameters

 
ARTICLE USAGE

4D Language Reference ( 4D v11 SQL Release 6)
4D Language Reference ( 4D v12.4)
4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)

Parent of : C_STRING ( 4D v13.5)