docs

Home All functions Legacy functions Categories

TokenMergeInString()

Clarion prototype

Prototype: TokenMergeInString(*CSTRING InSourceText, *CSTRING OutTargetText, LONG InOutTargetTextLen, *CSTRING InToken, *CSTRING InReplacement, LONG InFlags), SIGNED, PROC, PASCAL, RAW, NAME(‘TokenMergeInString’)

Purpose

Replaces token text inside a source string and writes the merged result to a caller-owned output buffer.

Parameters

Parameter Type Description
InSourceText *CSTRING Source text to inspect.
OutTargetText *CSTRING Target buffer receiving the merged result.
InOutTargetTextLen LONG Size of OutTargetText in bytes.
InToken *CSTRING Full token text to replace, such as [[FirstName]].
InReplacement *CSTRING Replacement value to insert.
InFlags LONG Merge option flags. 0=Replace all, case-sensitive, 1=First only, 2=Ignore case, 3=First only and ignore case.

Return value / error codes

Example (Clarion)

rc          LONG
srcText     CSTRING(1024)
outText     CSTRING(1024)
tokenText   CSTRING(80)
valueText   CSTRING(256)
flags       LONG

srcText   = 'Hello [[FirstName]], your code is [[Code]].'
outText   = ''
tokenText = '[[FirstName]]'
valueText = 'Charles'
flags     = 0

rc = TokenMergeInString(srcText, outText, SIZE(outText), tokenText, valueText, flags)
MESSAGE('TokenMergeInString rc=' & rc & ' text=' & outText)

Notes

Home All functions Legacy functions Categories