Click or drag to resize

SEvalA Function

X#
Execute a code block for each of the individual characters in a string, changing the contents of the argument as well as the return value.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION SEvalA(
	cString,
	cbBlock,
	nStart,
	nCount
) AS STRING CLIPPER
Request Example View Source

Parameters

cString (Optional)
Type: Usual
The string to scan.
cbBlock (Optional)
Type: Usual
The code block to execute for each character encountered.
nStart (Optional)
Type: Usual
nCount (Optional)
Type: Usual

Return Value

Type: String
A string of characters that have been processed by the code block.
Remarks
SEvalA() is identical to SEval() in that they both evaluate a code block once for each character of a string, passing the ASCII value and the character index as arguments.
The only difference is that, while SEval() ignores the return value of the code block, SEvalA() assigns the return value to the original string. See SEval() for details.
Examples
This example uses SEvalA() to change part of a string to uppercase:
X#
1LOCAL cString
2cString := "He was doa."
3? SEvalA(cString,;
4    {|cChar| Asc(Upper(Chr(cCha-r)))}, 8, 3)
5// "He was DOA."
6? cString                            // "He was DOA."
See Also