Click or drag to resize

SEvalA Function

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.5
Syntax
 FUNCTION SEvalA(
	cString AS USUAL,
	cbBlock AS USUAL,
	nStart AS USUAL,
	nCount AS USUAL
) AS STRING

Parameters

cString
Type: Usual
The string to scan.
cbBlock
Type: Usual
The code block to execute for each character encountered.
nStart
Type: Usual
nCount
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