2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 ANSI C function strrchr().
8 #include <aros/macros.h>
11 /*****************************************************************************
23 Searches for the last character c in a string.
26 str - Search this string
27 c - Look for this character
30 A pointer to the first occurence of c in str or NULL if c is not
38 strcpy (buffer, "Hello ");
40 // This returns a pointer to the second l in buffer.
41 strrchr (buffer, 'l');
44 strrchr (buffer, 'x');
52 It might seem that the algorithm below is slower than one which
53 first finds the end and then walks backwards but that would mean
54 to process some characters twice - if the string doesn't contain
55 c, it would mean to process every character twice.
57 ******************************************************************************/
63 /* those casts are needed to compare chars > 127 */
64 if ((unsigned char)*str
== (unsigned char)c
)
73 AROS_MAKE_ALIAS(strrchr
, rindex
);