src/cx/string.h

changeset 589
c290f8fd979e
parent 584
184e9ebfc3cc
child 645
ec50abb285ad
equal deleted inserted replaced
588:6a3cd8f0a2cf 589:c290f8fd979e
239 * 239 *
240 * The resulting string will be allocated by the specified allocator. 240 * The resulting string will be allocated by the specified allocator.
241 * So developers \em must pass the return value to cx_strfree() eventually. 241 * So developers \em must pass the return value to cx_strfree() eventually.
242 * 242 *
243 * \note It is guaranteed that there is only one allocation. 243 * \note It is guaranteed that there is only one allocation.
244 * It is also guaranteed that the returned string is zero-terminated.
244 * 245 *
245 * @param alloc the allocator to use 246 * @param alloc the allocator to use
246 * @param count the total number of strings to concatenate 247 * @param count the total number of strings to concatenate
247 * @param ... all strings 248 * @param ... all strings
248 * @return the concatenated string 249 * @return the concatenated string
257 /** 258 /**
258 * Concatenates two or more strings. 259 * Concatenates two or more strings.
259 * 260 *
260 * The resulting string will be allocated by standard \c malloc(). 261 * The resulting string will be allocated by standard \c malloc().
261 * So developers \em must pass the return value to cx_strfree() eventually. 262 * So developers \em must pass the return value to cx_strfree() eventually.
263 *
264 * \note It is guaranteed that there is only one allocation.
265 * It is also guaranteed that the returned string is zero-terminated.
262 * 266 *
263 * @param count the total number of strings to concatenate 267 * @param count the total number of strings to concatenate
264 * @param ... all strings 268 * @param ... all strings
265 * @return the concatenated string 269 * @return the concatenated string
266 */ 270 */
606 /** 610 /**
607 * Creates a duplicate of the specified string. 611 * Creates a duplicate of the specified string.
608 * 612 *
609 * The new string will contain a copy allocated by \p allocator. 613 * The new string will contain a copy allocated by \p allocator.
610 * 614 *
611 * \note The returned string is guaranteed to be zero-terminated and can safely 615 * \note The returned string is guaranteed to be zero-terminated.
612 * be passed to other APIs.
613 * 616 *
614 * @param allocator the allocator to use 617 * @param allocator the allocator to use
615 * @param string the string to duplicate 618 * @param string the string to duplicate
616 * @return a duplicate of the string 619 * @return a duplicate of the string
617 * @see cx_strdup() 620 * @see cx_strdup()
626 * Creates a duplicate of the specified string. 629 * Creates a duplicate of the specified string.
627 * 630 *
628 * The new string will contain a copy allocated by standard 631 * The new string will contain a copy allocated by standard
629 * \c malloc(). So developers \em must pass the return value to cx_strfree(). 632 * \c malloc(). So developers \em must pass the return value to cx_strfree().
630 * 633 *
631 * \note The returned string is guaranteed to be zero-terminated and can safely 634 * \note The returned string is guaranteed to be zero-terminated.
632 * be passed to other APIs.
633 * 635 *
634 * @param string the string to duplicate 636 * @param string the string to duplicate
635 * @return a duplicate of the string 637 * @return a duplicate of the string
636 * @see cx_strdup_a() 638 * @see cx_strdup_a()
637 */ 639 */
741 * Replaces a pattern in a string with another string. 743 * Replaces a pattern in a string with another string.
742 * 744 *
743 * The pattern is taken literally and is no regular expression. 745 * The pattern is taken literally and is no regular expression.
744 * Replaces at most \p replmax occurrences. 746 * Replaces at most \p replmax occurrences.
745 * 747 *
746 * The returned string will be allocated by \p allocator. 748 * The returned string will be allocated by \p allocator and is guaranteed
749 * to be zero-terminated.
747 * 750 *
748 * If allocation fails, or the input string is empty, 751 * If allocation fails, or the input string is empty,
749 * the returned string will be empty. 752 * the returned string will be empty.
750 * 753 *
751 * @param allocator the allocator to use 754 * @param allocator the allocator to use
768 * Replaces a pattern in a string with another string. 771 * Replaces a pattern in a string with another string.
769 * 772 *
770 * The pattern is taken literally and is no regular expression. 773 * The pattern is taken literally and is no regular expression.
771 * Replaces at most \p replmax occurrences. 774 * Replaces at most \p replmax occurrences.
772 * 775 *
773 * The returned string will be allocated by \c malloc() and \em must be passed 776 * The returned string will be allocated by \c malloc() and is guaranteed
774 * to cx_strfree() eventually. 777 * to be zero-terminated.
775 * 778 *
776 * If allocation fails, or the input string is empty, 779 * If allocation fails, or the input string is empty,
777 * the returned string will be empty. 780 * the returned string will be empty.
778 * 781 *
779 * @param str the string where replacements should be applied 782 * @param str the string where replacements should be applied
788 /** 791 /**
789 * Replaces a pattern in a string with another string. 792 * Replaces a pattern in a string with another string.
790 * 793 *
791 * The pattern is taken literally and is no regular expression. 794 * The pattern is taken literally and is no regular expression.
792 * 795 *
793 * The returned string will be allocated by \p allocator. 796 * The returned string will be allocated by \p allocator and is guaranteed
797 * to be zero-terminated.
794 * 798 *
795 * If allocation fails, or the input string is empty, 799 * If allocation fails, or the input string is empty,
796 * the returned string will be empty. 800 * the returned string will be empty.
797 * 801 *
798 * @param allocator the allocator to use 802 * @param allocator the allocator to use
808 * Replaces a pattern in a string with another string. 812 * Replaces a pattern in a string with another string.
809 * 813 *
810 * The pattern is taken literally and is no regular expression. 814 * The pattern is taken literally and is no regular expression.
811 * Replaces at most \p replmax occurrences. 815 * Replaces at most \p replmax occurrences.
812 * 816 *
813 * The returned string will be allocated by \c malloc() and \em must be passed 817 * The returned string will be allocated by \c malloc() and is guaranteed
814 * to cx_strfree() eventually. 818 * to be zero-terminated.
815 * 819 *
816 * If allocation fails, or the input string is empty, 820 * If allocation fails, or the input string is empty,
817 * the returned string will be empty. 821 * the returned string will be empty.
818 * 822 *
819 * @param str the string where replacements should be applied 823 * @param str the string where replacements should be applied

mercurial