CAPL Script

SubStrCpyOff

Syntax

void substr_cpy_off(char dest[], long destOffset, char src[], long srcStart, long len, long max)

Function

This function copies a substring ofsrctodest.maxindicates the the size ofdestin bytes. The function ensures that there is a terminating ‘\0’. Thus, a maximum of max-1-destOffset bytes are copied.

Parameters

dest Destination buffer

destOffset

Offset in bytes in destination buffer

src

Source string

srcStart

Start index in bytes insrcof substring

len

Length of the substring in bytes, or -1 to copy the string until the end

max

Size ofdestin bytes

Return Values

char s1[9] = "New CAPL";char s2[18] = "Vector Informatik";substr_cpy_off(s2, 7, s1, 4, -1, elcount(s2)); // s2: Vector CAPL

strstr