js_insert(3)

NAME
js_insert - insert one js_string string inside another js_string object

SYNOPSIS
#include JsStr.h

int js_insert(js_string *toinsert, js_string *target, int where)

DESCRIPTION
js_insert inserts the string inside the js_string object toinsert in to the js_string object target starting at where bytes from the beginning of the string. The number where determines the number of bytes in the target string before we insert the toinsert string. If where has a value of 0, we prepend toinsert before target, if where has a value of 1, we insert the string toinsert after the first byte of the string target, and so on.

ARGUMENTS
toinsert is a pointer to the js_string object we will place insert inside target. target is the js_string object that the toinsert string will be inserted in to. where is the number of bytes in target before the inserted string toinsert.

RETURN VALUE
js_insert returns JS_SUCCESS on successful insertion of the string, JS_ERROR otherwise.

EXAMPLE
The following example will give foo the string "1234567890":
	js_string *foo, *bar;
	foo = js_create(256,1);
	bar = js_create(256,1);
	js_str2js(foo,"1267890",10,1);
	js_str2js(bar,"345",3,1);
	js_insert(bar,foo,2); /* foo is now "1234567890" */

AUTHOR
Sam Trenholme <kiwi-zttfryb@koala.samiam.org>