10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

How Procedure Handles Work (ProcHandle Objects)The syntax for the _StringSub procedure is:varchar(2000) = _StringSub(string=varchar(2000),arg1=varchar(100), arg2=varchar(100), arg3=varchar(100),arg4=varchar(100), arg5=varchar(100), arg6=varchar(100),arg7=varchar(100), arg8=varchar(100),arg9=varchar(100));The following code is an example of this syntax:str1 = _StringSub(string = 'Employee Name:%1,Address:%2(c/o %1)', arg1 = 'John Doe',arg2 ='101 California, USA');The _StringTokenSub ProcedureThis example returns “Employee Name: John Doe, Address:101 California, USA(c/o John Doe)”.This procedure substitutes a value for the specified token in a string. Thesyntax for this procedure is:varchar(2000) =_StringTokenSub(string=varchar(2000),token=varchar(256),replacewith=varchar(256)[remainingtokens=byref(integer)]);The optional argument remainingtokens, if specified, is set to the number ofoccurrences of tokens that remain in the string after the substitution.The following example shows how to use the _StringTokenSub procedure:str1 = _StringTokenSub(string='Employee Name:John Doe, Address: 101 California,USA (c/o John Doe)', token = 'John Doe', replacewith='Jane Doe',remaingtoken=byref(icount));This example returns “Employee Name:Jane Doe, Address:101 California, USA(c/o John Doe)”. The icount variable contains 1, indicating that there is onemore occurrence of John Doe in the substituted string.Writing Scripts and Procedures 91

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!