Next: , Previous: , Up: Top   [Contents][Index]


3 An example of using the strings utility

This is a sample program that demonstrates how to use the strings utility:

#include <stdio.h>
#include "console/strings.h"

int main(int argc, char **argv)
{
    printf("Hello World");
    str s;
    s = "Hello world";
    printf("\n%s", s);
    printf("\n%d", indexof(s, 'H'));
    printf("\n%d", nindexof('H'));
    printf("\n%d", lindexof(s, 'H'));
    printf("\n%s", substr(s, 4));
    printf("\n%s", nsubstr(s, 4, 5));
    return 0;
}