js_fgrep_offset(3)

NAME
js_fgrep_offset - search

SYNOPSIS
#include JsStr.h

js_fgrep_offset(js_string *exp, js_string *js, int offset)

DESCRIPTION
js_fgrep_offset searches for the expression exp in the string js, starting at the offset offset.

The expression exp is simply a string that we look for in the string js. No characters are considered metacharacters in the expression exp.

The argument offset determines the minimum offset we will look for the expression exp at. An offset of 0 indicates we start looking at the beginning of the string js, an offset of 1 means that we will start looking at the second character in the string, and so on.

RETURN VALUE
js_fgrep_offset returns -2 if the exp was not found in the string js, the offset of the first found expression if the string was found (0 if it was found at the top of the string, 1 if it was found starting at the second character in the string, etc), and JS_ERROR if there was an error when searching for the expression.

EXAMPLE
The following example will find the second string "34" in the string "3434567890":

	js_string *foo, *bar;
	foo = js_create(256,1);
	bar = js_create(256,1);
	js_str2js(foo,"3434567890",10,1);
	js_str2js(bar,"34",2,1);
	printf("%d\n",js_fgrep_offset(bar,foo,1)); /* You will see 2 */

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