uoffset

Finds the offset of a character in a string.

Description

int uoffset(const char *s, int index);
Finds out the offset (in bytes from the start of the string) of the character at the specified `index' in the string `s'. A zero `index' parameter will return the first character of the string. If `index' is negative, it counts backward from the end of the string, so an `index' of `-1' will return an offset to the last character. Example:
      int from_third_letter = uoffset(text_string, 2);
Returns the offset in bytes to the specified character.

Related Projects

The following projects include source code containing this keyword: