js_substr(3)

NAME
js_substr - extract part of one js_string into another js_string object

SYNOPSIS
#include JsStr.h

int js_substr(js_string *source, js_string *dest, int start, int count)

DESCRIPTION
js_substr copys part of the js_string object source to the js_string object dest, starting start characters from the beginning of the string, copying count characters.

ARGUMENTS
source is the source js_string object, the string we copy part of. dest is the js_string object we copy over. start is the number of characters in to the string we start copying from. A value of 0 means we start copying from the beginning of the string, 1 means we start copying at the second character in the string, and so on. count is the number of characters we copy. 1 means we copy one character, 2 means we copy two characters, and so on. Be careful: there are cases where this behavior causes things to act a little different than expected.

RETURN VALUE
js_substr returns JS_SUCCESS on successful copying of the sbstring, JS_ERROR otherwise.

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

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