2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
5 C99 function strrchr().
8 #include <aros/macros.h>
10 /*****************************************************************************
22 Searches for the last character c in a string.
25 str - Search this string
26 c - Look for this character
29 A pointer to the first occurence of c in str or NULL if c is not
37 strcpy (buffer, "Hello ");
39 // This returns a pointer to the second l in buffer.
40 strrchr (buffer, 'l');
43 strrchr (buffer, 'x');
51 It might seem that the algorithm below is slower than one which
52 first finds the end and then walks backwards but that would mean
53 to process some characters twice - if the string doesn't contain
54 c, it would mean to process every character twice.
56 ******************************************************************************/
62 /* those casts are needed to compare chars > 127 */
63 if ((unsigned char)*str
== (unsigned char)c
)