src/cx/string.h

changeset 1646
85fd3ff8416e
parent 1644
bbe3199e37fc
equal deleted inserted replaced
1644:bbe3199e37fc 1646:85fd3ff8416e
637 */ 637 */
638 cx_attr_nodiscard 638 cx_attr_nodiscard
639 CX_EXPORT cxmutstr cx_strrchr_m(cxmutstr string, int chr); 639 CX_EXPORT cxmutstr cx_strrchr_m(cxmutstr string, int chr);
640 640
641 /** 641 /**
642 * Searches for a specific substring.
643 *
644 * Internal function - do not use.
645 *
646 * @param haystack the string to be scanned
647 * @param needle string containing the sequence of characters to match
648 * @return a substring starting at the first occurrence of @p needle,
649 * or an empty string, if the sequence is not contained
650 * @see cx_strstr()
651 */
652 cx_attr_nodiscard
653 CX_EXPORT cxstring cx_strstr_(cxstring haystack, cxstring needle);
654
655 /**
642 * Returns a substring starting at the location of the first occurrence of the 656 * Returns a substring starting at the location of the first occurrence of the
643 * specified string. 657 * specified string.
644 * 658 *
645 * If @p haystack does not contain @p needle, an empty string is returned. 659 * If @p haystack does not contain @p needle, an empty string is returned.
646 * 660 *
647 * If @p needle is an empty string, the complete @p haystack is 661 * If @p needle is an empty string, the complete @p haystack is
648 * returned. 662 * returned.
649 * 663 *
664 * @param haystack (@c cxstring) the string to be scanned
665 * @param needle string containing the sequence of characters to match
666 * @return (@c cxstring) a substring starting at the first occurrence of
667 * @p needle, or an empty string, if the sequence is not contained
668 * @see cx_strstr_m()
669 */
670 #define cx_strstr(haystack, needle) cx_strstr_(haystack, cx_strcast(needle))
671
672 /**
673 * Searches for a specific substring.
674 *
675 * Internal function - do not use.
676 *
650 * @param haystack the string to be scanned 677 * @param haystack the string to be scanned
651 * @param needle string containing the sequence of characters to match 678 * @param needle string containing the sequence of characters to match
652 * @return a substring starting at the first occurrence of 679 * @return a substring starting at the first occurrence of @p needle,
653 * @p needle, or an empty string, if the sequence is not 680 * or an empty string, if the sequence is not contained
654 * contained
655 * @see cx_strstr_m() 681 * @see cx_strstr_m()
656 */ 682 */
657 cx_attr_nodiscard 683 cx_attr_nodiscard
658 CX_EXPORT cxstring cx_strstr(cxstring haystack, cxstring needle); 684 CX_EXPORT cxmutstr cx_strstr_m_(cxmutstr haystack, cxstring needle);
659 685
660 /** 686 /**
661 * Returns a substring starting at the location of the first occurrence of the 687 * Returns a substring starting at the location of the first occurrence of the
662 * specified string. 688 * specified string.
663 * 689 *
664 * If @p haystack does not contain @p needle, an empty string is returned. 690 * If @p haystack does not contain @p needle, an empty string is returned.
665 * 691 *
666 * If @p needle is an empty string, the complete @p haystack is 692 * If @p needle is an empty string, the complete @p haystack is
667 * returned. 693 * returned.
668 * 694 *
669 * @param haystack the string to be scanned 695 * @param haystack (@c cxmutstr) the string to be scanned
670 * @param needle string containing the sequence of characters to match 696 * @param needle string containing the sequence of characters to match
671 * @return a substring starting at the first occurrence of 697 * @return (@c cxmutstr) a substring starting at the first occurrence of
672 * @p needle, or an empty string, if the sequence is not 698 * @p needle, or an empty string, if the sequence is not contained
673 * contained
674 * @see cx_strstr() 699 * @see cx_strstr()
675 */ 700 */
676 cx_attr_nodiscard 701 #define cx_strstr_m(haystack, needle) cx_strstr_m_(haystack, cx_strcast(needle))
677 CX_EXPORT cxmutstr cx_strstr_m(cxmutstr haystack, cxstring needle);
678 702
679 /** 703 /**
680 * Splits a given string using a delimiter string. 704 * Splits a given string using a delimiter string.
681 * 705 *
682 * @note The resulting array contains strings that point to the source 706 * @note The resulting array contains strings that point to the source

mercurial