This article applies to:
E-Prime 3.0
E-Prime 2.0
This item was introduced in E-Prime 2.0 (2.0.10.242).
Detail
Syntax
stringVariable = DelimitText ( string delimiter, string expression, string expression, [string expression]….)
Description
The DelimitText function simplifies the concatenation of character strings. Concatenation, or the joining together of individual strings, is often used when sending text information to the display screen (e.g., assigning the TextDisplay.Text property), sending text information to the E-Prime Debug pane (e.g. specifying the string parameter for the Debug.Print method), or when writing out information to a text-based log file (e.g. specifying the expression parameter for the Write method).
Prior to the introduction of the DelimitText function, strings had to be concatenated via operating chaining, with each string element added to the last element with the ampersand (&) operator. Further, if a delimiting string was needed to separate the individual string elements, then this string separator had to be manually inserted between each string (e.g. "Column Heading 1" & ebTab &"Column Heading 2" & ebTab & "Last Column Heading").
The DelimitText function simplifies the process of string concatenation by eliminating the need to use the ampersand operator to combine the string elements. It also eliminates the need to repeatedly add the text delimiter between each string element and instead allows the delimiter to be defined only one time.
Comments
As with all string operations in E-Prime, the string expressions used in DelimitText can be any combination of string constants (e.g. ebTab), string variables (e.g. Dim ) and literal strings (e.g. "Hello!").
Example
'This example utilizes the DelimitText command to
'print multiple values to the output window at the end of each Trial.
Dim time1 As Long
Dim time2 As Long
time1 = Clock.Read
Sleep 1000
time2 = Clock.Read
Debug.Print DelimitText("\t", TextStimulus.OnsetTime, TextStimulus.OnsetTime + TextStimulus.Duration, time1, time2)
'NOTE: To run this example, copy the script above and
'paste it into an InLine object post stimulus presentation.
'Change the name of TextStimulus to the name of the
'stimulus presentation object.
Here is another example that illustrates the difference between DelimitText and the ampersand operator to concatenate strings.
Dim strOut As String
strOut = DelimitText(ebTab,
"ACC", _
"CRESP", _
"RESP", _
"RT", _
"RTTime", _
"OnsetDelay" , _
"OnsetTime" , _
"OnsetToOnsetTime" , _
"Duration" , _
"TimingMode")
Notice the underscore character (_) is used as a line continuation character. This enables each string to be placed on a separate line. Doing so is a matter of style; however, it can make it easier to line things up when creating column headers. For more details on the line continuation character, search for "_ (keyword)" in the E-Prime Command Reference (https://pstnet.com/ecr).
Without DelimitText, the same script above would have to be written out as follows:
Dim strOut As String
strOut = ebTab & "ACC" & ebTab & "CRESP" & ebTab & "RESP" & ebTab & "RT" & ebTab & "RTTime" & ebTab & "OnsetDelay" & ebTab & "OnsetTime" & ebTab & "OnsetToOnsetTime" & ebTab & "Duration" & ebTab & "TimingMode"
Comments
0 comments
Please sign in to leave a comment.