docs

Home All functions Categories

vuReplaceChars(MainStrg, OldStrg, NewStrg)

vuReplaceChars(*CSTRING, *CSTRING, *CSTRING), Long

Description

Replaces every occurrence of OldStrg with NewStrg directly in MainStrg. It does not return a modified string. NewStrg may be shorter or longer than OldStrg.

Build 209 guidance: This is the legacy three-parameter function. It has no destination size argument and performs no capacity validation. Prefer vuReplaceCharsEx in new applications, particularly when replacement may make the text longer.

Parameters

Parameter Data Type Description
MainStrg CSTRING Input and output string, modified in place. The caller must allocate enough capacity, including its terminating null byte.
OldStrg CSTRING Substring to find.
NewStrg CSTRING Replacement substring.

The old 256/128/128 example sizes are not requirements. The actual parameters are CSTRING references; their capacities may differ.

Returns

A LONG with value 1 after the function executes its replacement statement. The function does not count matches or indicate whether a particular occurrence was found; it has no explicit buffer-failure test. The returned LONG is not a CSTRING.

Example

MainStrg CSTRING(256)
OldStrg  CSTRING(128)
NewStrg  CSTRING(128)
Result   LONG

CODE
MainStrg = 'Microsoft Windows XP is no longer supported.'
OldStrg  = 'Windows XP'
NewStrg  = 'Windows Vista'

Result = vuReplaceChars(MainStrg, OldStrg, NewStrg)
MESSAGE(MainStrg)  ! Microsoft Windows Vista is no longer supported.
! Result = 1

Notes

Home All functions Categories