VirtualBox

Changeset 57719 in vbox for trunk


Ignore:
Timestamp:
Sep 11, 2015 2:48:00 PM (9 years ago)
Author:
vboxsync
Message:

iprt/string.h: Added RTStrOffCharOrTerm.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/string.h

    r57184 r57719  
    25342534
    25352535/**
     2536 * Finds the offset at which a simple character first occurs in a string.
     2537 *
     2538 * @returns The offset of the first occurence or the terminator offset.
     2539 * @param   pszHaystack The string to search.
     2540 * @param   chNeedle    The character to search for.
     2541 */
     2542DECLINLINE(size_t) RTStrOffCharOrTerm(const char *pszHaystack, char chNeedle)
     2543{
     2544    const char *psz = pszHaystack;
     2545    char ch;
     2546    while (   (ch = *psz) != chNeedle
     2547           && ch != '\0')
     2548        psz++;
     2549    return psz - pszHaystack;
     2550}
     2551
     2552
     2553/**
    25362554 * Matches a simple string pattern.
    25372555 *
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette