253 */ |
253 */ |
254 scstr_t scstrn(const char *cstring, size_t length); |
254 scstr_t scstrn(const char *cstring, size_t length); |
255 |
255 |
256 /** |
256 /** |
257 * Returns the cumulated length of all specified strings. |
257 * Returns the cumulated length of all specified strings. |
258 * |
258 * |
259 * At least one string must be specified. |
259 * You may arbitrarily mix up mutable (<code>sstr_t</code>) and immutable |
|
260 * (<code>scstr_t</code>) strings. |
260 * |
261 * |
261 * <b>Attention:</b> if the count argument does not match the count of the |
262 * <b>Attention:</b> if the count argument does not match the count of the |
262 * specified strings, the behavior is undefined. |
263 * specified strings, the behavior is undefined. |
263 * |
264 * |
264 * @param count the total number of specified strings (so at least 1) |
265 * @param count the total number of specified strings (so at least 1) |
265 * @param string the first string |
266 * @param ... all strings |
266 * @param ... all other strings |
|
267 * @return the cumulated length of all strings |
267 * @return the cumulated length of all strings |
268 */ |
268 */ |
269 size_t ucx_strnlen(size_t count, ...); |
269 size_t ucx_strnlen(size_t count, ...); |
270 |
270 |
|
271 /** |
|
272 * Alias for ucx_strnlen(). |
|
273 * |
|
274 * @param count the total number of specified strings (so at least 1) |
|
275 * @param ... all strings |
|
276 * @return the cumulated length of all strings |
|
277 */ |
271 #define sstrnlen(count, ...) ucx_strnlen(count, __VA_ARGS__) |
278 #define sstrnlen(count, ...) ucx_strnlen(count, __VA_ARGS__) |
272 |
279 |
273 /** |
280 /** |
274 * Concatenates two or more strings. |
281 * Concatenates two or more strings. |
275 * |
282 * |
335 * @see sstrsubs() |
362 * @see sstrsubs() |
336 * @see sstrchr() |
363 * @see sstrchr() |
337 */ |
364 */ |
338 sstr_t sstrsubsl(sstr_t string, size_t start, size_t length); |
365 sstr_t sstrsubsl(sstr_t string, size_t start, size_t length); |
339 |
366 |
340 scstr_t scstrsubs(scstr_t s, size_t start); |
367 /** |
|
368 * Returns a substring of an immutable string starting at the specified |
|
369 * location. |
|
370 * |
|
371 * <b>Attention:</b> the new string references the same memory area as the |
|
372 * input string and will <b>NOT</b> be <code>NULL</code>-terminated. |
|
373 * Use scstrdup() to get a copy. |
|
374 * |
|
375 * @param string input string |
|
376 * @param start start location of the substring |
|
377 * @return a substring of <code>string</code> starting at <code>start</code> |
|
378 * |
|
379 * @see scstrsubsl() |
|
380 * @see scstrchr() |
|
381 */ |
|
382 scstr_t scstrsubs(scstr_t string, size_t start); |
|
383 |
|
384 /** |
|
385 * Returns a substring of an immutable string with a maximum length starting |
|
386 * at the specified location. |
|
387 * |
|
388 * <b>Attention:</b> the new string references the same memory area as the |
|
389 * input string and will <b>NOT</b> be <code>NULL</code>-terminated. |
|
390 * Use scstrdup() to get a copy. |
|
391 * |
|
392 * @param string input string |
|
393 * @param start start location of the substring |
|
394 * @param length the maximum length of the substring |
|
395 * @return a substring of <code>string</code> starting at <code>start</code> |
|
396 * with a maximum length of <code>length</code> |
|
397 * |
|
398 * @see scstrsubs() |
|
399 * @see scstrchr() |
|
400 */ |
341 scstr_t scstrsubsl(scstr_t string, size_t start, size_t length); |
401 scstr_t scstrsubsl(scstr_t string, size_t start, size_t length); |
342 |
|
343 |
|
344 int ucx_strchr(const char *string, size_t length, int chr, size_t *pos); |
|
345 int ucx_strrchr(const char *string, size_t length, int chr, size_t *pos); |
|
346 |
402 |
347 /** |
403 /** |
348 * Returns a substring starting at the location of the first occurrence of the |
404 * Returns a substring starting at the location of the first occurrence of the |
349 * specified character. |
405 * specified character. |
350 * |
406 * |
397 * @return a substring starting at the first occurrence of |
470 * @return a substring starting at the first occurrence of |
398 * <code>match</code>, or an empty string, if the sequence is not |
471 * <code>match</code>, or an empty string, if the sequence is not |
399 * present in <code>string</code> |
472 * present in <code>string</code> |
400 */ |
473 */ |
401 sstr_t ucx_sstrstr(sstr_t string, scstr_t match); |
474 sstr_t ucx_sstrstr(sstr_t string, scstr_t match); |
|
475 |
|
476 /** |
|
477 * Alias for ucx_sstrstr() which automatically casts the match string. |
|
478 * |
|
479 * @param string the string to be scanned |
|
480 * @param match string containing the sequence of characters to match |
|
481 * @return a substring starting at the first occurrence of |
|
482 * <code>match</code>, or an empty string, if the sequence is not |
|
483 * present in <code>string</code> |
|
484 */ |
402 #define sstrstr(string, match) ucx_sstrstr(string, SCSTR(match)) |
485 #define sstrstr(string, match) ucx_sstrstr(string, SCSTR(match)) |
403 |
486 |
|
487 /** |
|
488 * Returns an immutable substring starting at the location of the |
|
489 * first occurrence of the specified immutable string. |
|
490 * |
|
491 * If the string does not contain the other string, an empty string is returned. |
|
492 * |
|
493 * If <code>match</code> is an empty string, the complete <code>string</code> is |
|
494 * returned. |
|
495 * |
|
496 * @param string the string to be scanned |
|
497 * @param match string containing the sequence of characters to match |
|
498 * @return a substring starting at the first occurrence of |
|
499 * <code>match</code>, or an empty string, if the sequence is not |
|
500 * present in <code>string</code> |
|
501 */ |
404 scstr_t ucx_scstrstr(scstr_t string, scstr_t match); |
502 scstr_t ucx_scstrstr(scstr_t string, scstr_t match); |
|
503 |
|
504 /** |
|
505 * Alias for ucx_scstrstr() which automatically casts the match string. |
|
506 * |
|
507 * @param string the string to be scanned |
|
508 * @param match string containing the sequence of characters to match |
|
509 * @return a substring starting at the first occurrence of |
|
510 * <code>match</code>, or an empty string, if the sequence is not |
|
511 * present in <code>string</code> |
|
512 */ |
405 #define scstrstr(string, match) ucx_scstrstr(string, SCSTR(match)) |
513 #define scstrstr(string, match) ucx_scstrstr(string, SCSTR(match)) |
406 |
514 |
407 /** |
515 /** |
408 * Splits a string into parts by using a delimiter string. |
516 * Splits a string into parts by using a delimiter string. |
409 * |
517 * |
445 * @param string the string to split |
553 * @param string the string to split |
446 * @param delim the delimiter string |
554 * @param delim the delimiter string |
447 * @param count IN: the maximum size of the resulting array (0 = no limit), |
555 * @param count IN: the maximum size of the resulting array (0 = no limit), |
448 * OUT: the actual size of the array |
556 * OUT: the actual size of the array |
449 * @return a sstr_t array containing the split strings or |
557 * @return a sstr_t array containing the split strings or |
450 * <code>NULL</code> on error |
558 * <code>NULL</code> on error |
|
559 * |
|
560 * @see ucx_strsplit_a() |
|
561 */ |
|
562 sstr_t* ucx_strsplit(scstr_t string, scstr_t delim, ssize_t *count); |
|
563 |
|
564 /** |
|
565 * Alias for ucx_strsplit() which automatically casts the arguments. |
|
566 * |
|
567 * @param string the string to split |
|
568 * @param delim the delimiter string |
|
569 * @param count IN: the maximum size of the resulting array (0 = no limit), |
|
570 * OUT: the actual size of the array |
|
571 * @return a sstr_t array containing the split strings or |
|
572 * <code>NULL</code> on error |
451 * |
573 * |
452 * @see sstrsplit_a() |
574 * @see sstrsplit_a() |
453 */ |
575 */ |
454 sstr_t* ucx_strsplit(scstr_t string, scstr_t delim, ssize_t *count); |
576 #define sstrsplit(string, delim, count) \ |
455 |
577 ucx_strsplit(SCSTR(string), SCSTR(delim), count) |
456 #define sstrsplit(s, delim, count) ucx_strsplit(SCSTR(s), SCSTR(delim), count) |
|
457 |
578 |
458 /** |
579 /** |
459 * Performing sstrsplit() using a UcxAllocator. |
580 * Performing sstrsplit() using a UcxAllocator. |
460 * |
581 * |
461 * <i>Read the description of sstrsplit() for details.</i> |
582 * <i>Read the description of sstrsplit() for details.</i> |
471 * @param string the string to split |
592 * @param string the string to split |
472 * @param delim the delimiter string |
593 * @param delim the delimiter string |
473 * @param count IN: the maximum size of the resulting array (0 = no limit), |
594 * @param count IN: the maximum size of the resulting array (0 = no limit), |
474 * OUT: the actual size of the array |
595 * OUT: the actual size of the array |
475 * @return a sstr_t array containing the split strings or |
596 * @return a sstr_t array containing the split strings or |
476 * <code>NULL</code> on error |
597 * <code>NULL</code> on error |
477 * |
598 * |
478 * @see sstrsplit() |
599 * @see ucx_strsplit() |
479 */ |
600 */ |
480 sstr_t* ucx_strsplit_a(UcxAllocator *allocator, scstr_t string, scstr_t delim, |
601 sstr_t* ucx_strsplit_a(UcxAllocator *allocator, scstr_t string, scstr_t delim, |
481 ssize_t *count); |
602 ssize_t *count); |
482 |
603 |
483 #define sstrsplit_a(a, s, d, c) ucx_strsplit_a(a, SCSTR(s), SCSTR(d, c)) |
604 /** |
|
605 * Alias for ucx_strsplit_a() which automatically casts the arguments. |
|
606 * |
|
607 * @param allocator the UcxAllocator used for allocating memory |
|
608 * @param string the string to split |
|
609 * @param delim the delimiter string |
|
610 * @param count IN: the maximum size of the resulting array (0 = no limit), |
|
611 * OUT: the actual size of the array |
|
612 * @return a sstr_t array containing the split strings or |
|
613 * <code>NULL</code> on error |
|
614 * |
|
615 * @see sstrsplit() |
|
616 */ |
|
617 #define sstrsplit_a(allocator, string, delim, count) \ |
|
618 ucx_strsplit_a(allocator, SCSTR(string), SCSTR(delim, count)) |
484 |
619 |
485 /** |
620 /** |
486 * Compares two UCX strings with standard <code>memcmp()</code>. |
621 * Compares two UCX strings with standard <code>memcmp()</code>. |
487 * |
622 * |
488 * At first it compares the sstr_t.length attribute of the two strings. The |
623 * At first it compares the scstr_t.length attribute of the two strings. The |
489 * <code>memcmp()</code> function is called, if and only if the lengths match. |
624 * <code>memcmp()</code> function is called, if and only if the lengths match. |
490 * |
625 * |
491 * @param s1 the first string |
626 * @param s1 the first string |
492 * @param s2 the second string |
627 * @param s2 the second string |
493 * @return -1, if the length of s1 is less than the length of s2 or 1, if the |
628 * @return -1, if the length of s1 is less than the length of s2 or 1, if the |
494 * length of s1 is greater than the length of s2 or the result of |
629 * length of s1 is greater than the length of s2 or the result of |
495 * <code>memcmp()</code> otherwise (i.e. 0 if the strings match) |
630 * <code>memcmp()</code> otherwise (i.e. 0 if the strings match) |
496 */ |
631 */ |
497 int ucx_strcmp(scstr_t s1, scstr_t s2); |
632 int ucx_strcmp(scstr_t s1, scstr_t s2); |
498 |
633 |
|
634 /** |
|
635 * Alias for ucx_strcmp() which automatically casts its arguments. |
|
636 * |
|
637 * @param s1 the first string |
|
638 * @param s2 the second string |
|
639 * @return -1, if the length of s1 is less than the length of s2 or 1, if the |
|
640 * length of s1 is greater than the length of s2 or the result of |
|
641 * <code>memcmp()</code> otherwise (i.e. 0 if the strings match) |
|
642 */ |
499 #define sstrcmp(s1, s2) ucx_strcmp(SCSTR(s1), SCSTR(s2)) |
643 #define sstrcmp(s1, s2) ucx_strcmp(SCSTR(s1), SCSTR(s2)) |
500 |
644 |
501 /** |
645 /** |
502 * Compares two UCX strings ignoring the case. |
646 * Compares two UCX strings ignoring the case. |
503 * |
647 * |
506 * the case. |
650 * the case. |
507 * |
651 * |
508 * @param s1 the first string |
652 * @param s1 the first string |
509 * @param s2 the second string |
653 * @param s2 the second string |
510 * @return -1, if the length of s1 is less than the length of s2 or 1, if the |
654 * @return -1, if the length of s1 is less than the length of s2 or 1, if the |
511 * length of s1 is greater than the length of s2 or the difference between the |
655 * length of s1 is greater than the length of s2 or the result of the platform |
512 * first two differing characters otherwise (i.e. 0 if the strings match and |
656 * specific string comparison function ignoring the case. |
513 * no characters differ) |
|
514 */ |
657 */ |
515 int ucx_strcasecmp(scstr_t s1, scstr_t s2); |
658 int ucx_strcasecmp(scstr_t s1, scstr_t s2); |
516 |
659 |
|
660 /** |
|
661 * Alias for ucx_strcasecmp() which automatically casts the arguments. |
|
662 * |
|
663 * @param s1 the first string |
|
664 * @param s2 the second string |
|
665 * @return -1, if the length of s1 is less than the length of s2 or 1, if the |
|
666 * length of s1 is greater than the length of s2 or the result of the platform |
|
667 * specific string comparison function ignoring the case. |
|
668 */ |
517 #define sstrcasecmp(s1, s2) ucx_strcasecmp(SCSTR(s1), SCSTR(s2)) |
669 #define sstrcasecmp(s1, s2) ucx_strcasecmp(SCSTR(s1), SCSTR(s2)) |
518 |
670 |
519 /** |
671 /** |
520 * Creates a duplicate of the specified string. |
672 * Creates a duplicate of the specified string. |
521 * |
673 * |
522 * The new sstr_t will contain a copy allocated by standard |
674 * The new sstr_t will contain a copy allocated by standard |
523 * <code>malloc()</code>. So developers <b>MUST</b> pass the sstr_t.ptr to |
675 * <code>malloc()</code>. So developers <b>MUST</b> pass the sstr_t.ptr to |
524 * <code>free()</code>. |
676 * <code>free()</code>. |
525 * |
677 * |
526 * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- |
678 * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- |
527 * terminated and mutable. |
679 * terminated and mutable, regardless of the argument. |
|
680 * |
|
681 * @param string the string to duplicate |
|
682 * @return a duplicate of the string |
|
683 * @see ucx_strdup_a() |
|
684 */ |
|
685 sstr_t ucx_strdup(scstr_t string); |
|
686 |
|
687 /** |
|
688 * Alias for ucx_strdup() which automatically casts the argument. |
528 * |
689 * |
529 * @param string the string to duplicate |
690 * @param string the string to duplicate |
530 * @return a duplicate of the string |
691 * @return a duplicate of the string |
531 * @see sstrdup_a() |
692 * @see sstrdup_a() |
532 */ |
693 */ |
533 sstr_t scstrdup(scstr_t string); |
694 #define sstrdup(string) ucx_strdup(SCSTR(string)) |
534 |
|
535 #define sstrdup(s) scstrdup(SCSTR(s)) |
|
536 |
695 |
537 /** |
696 /** |
538 * Creates a duplicate of the specified string using a UcxAllocator. |
697 * Creates a duplicate of the specified string using a UcxAllocator. |
539 * |
698 * |
540 * The new sstr_t will contain a copy allocated by the allocators |
699 * The new sstr_t will contain a copy allocated by the allocators |
541 * ucx_allocator_malloc function. So it is implementation depended, whether the |
700 * ucx_allocator_malloc function. So it is implementation depended, whether the |
542 * returned sstr_t.ptr pointer must be passed to the allocators |
701 * returned sstr_t.ptr pointer must be passed to the allocators |
543 * ucx_allocator_free function manually. |
702 * ucx_allocator_free function manually. |
544 * |
703 * |
545 * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- |
704 * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- |
546 * terminated. |
705 * terminated and mutable, regardless of the argument. |
547 * |
706 * |
548 * @param allocator a valid instance of a UcxAllocator |
707 * @param allocator a valid instance of a UcxAllocator |
549 * @param string the string to duplicate |
708 * @param string the string to duplicate |
550 * @return a duplicate of the string |
709 * @return a duplicate of the string |
551 * @see sstrdup() |
710 * @see ucx_strdup() |
552 */ |
711 */ |
553 sstr_t scstrdup_a(UcxAllocator *allocator, scstr_t string); |
712 sstr_t ucx_strdup_a(UcxAllocator *allocator, scstr_t string); |
554 |
713 |
555 #define sstrdup_a(allocator, s) scstrdup_a(allocator, SCSTR(s)) |
714 /** |
556 |
715 * Alias for ucx_strdup_a() which automatically casts the argument. |
557 |
716 * |
558 size_t ucx_strtrim(const char *str, size_t length, size_t *newlen); |
717 * @param allocator a valid instance of a UcxAllocator |
|
718 * @param string the string to duplicate |
|
719 * @return a duplicate of the string |
|
720 * @see ucx_strdup() |
|
721 */ |
|
722 #define sstrdup_a(allocator, string) ucx_strdup_a(allocator, SCSTR(string)) |
|
723 |
559 |
724 |
560 /** |
725 /** |
561 * Omits leading and trailing spaces. |
726 * Omits leading and trailing spaces. |
562 * |
727 * |
563 * This function returns a new sstr_t containing a trimmed version of the |
728 * This function returns a new sstr_t containing a trimmed version of the |
574 * @param string the string that shall be trimmed |
739 * @param string the string that shall be trimmed |
575 * @return a new sstr_t containing the trimmed string |
740 * @return a new sstr_t containing the trimmed string |
576 */ |
741 */ |
577 sstr_t sstrtrim(sstr_t string); |
742 sstr_t sstrtrim(sstr_t string); |
578 |
743 |
|
744 /** |
|
745 * Omits leading and trailing spaces. |
|
746 * |
|
747 * This function returns a new scstr_t containing a trimmed version of the |
|
748 * specified string. |
|
749 * |
|
750 * <b>Note:</b> the new scstr_t references the same memory, thus you |
|
751 * <b>MUST NOT</b> pass the scstr_t.ptr of the return value to |
|
752 * <code>free()</code>. It is also highly recommended to avoid assignments like |
|
753 * <code>mystr = scstrtrim(mystr);</code> as you lose the reference to the |
|
754 * source string. Assignments of this type are only permitted, if the |
|
755 * scstr_t.ptr of the source string does not need to be freed or if another |
|
756 * reference to the source string exists. |
|
757 * |
|
758 * @param string the string that shall be trimmed |
|
759 * @return a new scstr_t containing the trimmed string |
|
760 */ |
579 scstr_t scstrtrim(scstr_t string); |
761 scstr_t scstrtrim(scstr_t string); |
580 |
762 |
581 /** |
763 /** |
582 * Checks, if a string has a specific prefix. |
764 * Checks, if a string has a specific prefix. |
583 * @param string the string to check |
765 * @param string the string to check |
584 * @param prefix the prefix the string should have |
766 * @param prefix the prefix the string should have |
585 * @return 1, if and only if the string has the specified prefix, 0 otherwise |
767 * @return 1, if and only if the string has the specified prefix, 0 otherwise |
586 */ |
768 */ |
587 int ucx_strprefix(scstr_t string, scstr_t prefix); |
769 int ucx_strprefix(scstr_t string, scstr_t prefix); |
588 |
770 |
|
771 /** |
|
772 * Alias for ucx_strprefix() which automatically casts the arguments. |
|
773 * |
|
774 * @param string the string to check |
|
775 * @param prefix the prefix the string should have |
|
776 * @return 1, if and only if the string has the specified prefix, 0 otherwise |
|
777 */ |
589 #define sstrprefix(string, prefix) ucx_strprefix(SCSTR(string), SCSTR(prefix)) |
778 #define sstrprefix(string, prefix) ucx_strprefix(SCSTR(string), SCSTR(prefix)) |
590 |
779 |
591 /** |
780 /** |
592 * Checks, if a string has a specific suffix. |
781 * Checks, if a string has a specific suffix. |
593 * @param string the string to check |
782 * @param string the string to check |
594 * @param suffix the suffix the string should have |
783 * @param suffix the suffix the string should have |
595 * @return 1, if and only if the string has the specified suffix, 0 otherwise |
784 * @return 1, if and only if the string has the specified suffix, 0 otherwise |
596 */ |
785 */ |
597 int ucx_strsuffix(scstr_t string, scstr_t suffix); |
786 int ucx_strsuffix(scstr_t string, scstr_t suffix); |
598 |
787 |
599 #define sstrsuffix(string, prefix) ucx_strsuffix(SCSTR(string), SCSTR(prefix)) |
788 /** |
|
789 * Alias for ucx_strsuffix() which automatically casts the arguments. |
|
790 * |
|
791 * @param string the string to check |
|
792 * @param suffix the suffix the string should have |
|
793 * @return 1, if and only if the string has the specified suffix, 0 otherwise |
|
794 */ |
|
795 #define sstrsuffix(string, suffix) ucx_strsuffix(SCSTR(string), SCSTR(suffix)) |
600 |
796 |
601 /** |
797 /** |
602 * Returns a lower case version of a string. |
798 * Returns a lower case version of a string. |
603 * |
799 * |
604 * This function creates a duplicate of the input string, first. See the |
800 * This function creates a duplicate of the input string, first. See the |
605 * documentation of sstrdup() for the implications. |
801 * documentation of scstrdup() for the implications. |
606 * |
802 * |
607 * @param string the input string |
803 * @param string the input string |
608 * @return the resulting lower case string |
804 * @return the resulting lower case string |
609 * @see sstrdup() |
805 * @see scstrdup() |
610 */ |
806 */ |
611 sstr_t ucx_strlower(scstr_t string); |
807 sstr_t ucx_strlower(scstr_t string); |
612 |
808 |
|
809 /** |
|
810 * Alias for ucx_strlower() which automatically casts the argument. |
|
811 * |
|
812 * @param string the input string |
|
813 * @return the resulting lower case string |
|
814 */ |
613 #define sstrlower(string) ucx_strlower(SCSTR(string)) |
815 #define sstrlower(string) ucx_strlower(SCSTR(string)) |
614 |
816 |
615 /** |
817 /** |
616 * Returns a lower case version of a string. |
818 * Returns a lower case version of a string. |
617 * |
819 * |
618 * This function creates a duplicate of the input string, first. See the |
820 * This function creates a duplicate of the input string, first. See the |
619 * documentation of sstrdup_a() for the implications. |
821 * documentation of scstrdup_a() for the implications. |
620 * |
822 * |
621 * @param allocator the allocator used for duplicating the string |
823 * @param allocator the allocator used for duplicating the string |
622 * @param string the input string |
824 * @param string the input string |
623 * @return the resulting lower case string |
825 * @return the resulting lower case string |
624 * @see sstrdup_a() |
826 * @see scstrdup_a() |
625 */ |
827 */ |
626 sstr_t ucx_strlower_a(UcxAllocator *allocator, scstr_t string); |
828 sstr_t ucx_strlower_a(UcxAllocator *allocator, scstr_t string); |
627 |
829 |
|
830 |
|
831 /** |
|
832 * Alias for ucx_strlower_a() which automatically casts the argument. |
|
833 * |
|
834 * @param allocator the allocator used for duplicating the string |
|
835 * @param string the input string |
|
836 * @return the resulting lower case string |
|
837 */ |
628 #define sstrlower_a(allocator, string) ucx_strlower_a(allocator, SCSTR(string)) |
838 #define sstrlower_a(allocator, string) ucx_strlower_a(allocator, SCSTR(string)) |
629 |
839 |
630 /** |
840 /** |
631 * Returns a upper case version of a string. |
841 * Returns a upper case version of a string. |
632 * |
842 * |
633 * This function creates a duplicate of the input string, first. See the |
843 * This function creates a duplicate of the input string, first. See the |
634 * documentation of sstrdup() for the implications. |
844 * documentation of scstrdup() for the implications. |
635 * |
845 * |
636 * @param string the input string |
846 * @param string the input string |
637 * @return the resulting upper case string |
847 * @return the resulting upper case string |
638 * @see sstrdup() |
848 * @see scstrdup() |
639 */ |
849 */ |
640 sstr_t ucx_strupper(scstr_t string); |
850 sstr_t ucx_strupper(scstr_t string); |
641 |
851 |
|
852 /** |
|
853 * Alias for ucx_strupper() which automatically casts the argument. |
|
854 * |
|
855 * @param string the input string |
|
856 * @return the resulting upper case string |
|
857 */ |
642 #define sstrupper(string) ucx_strupper(SCSTR(string)) |
858 #define sstrupper(string) ucx_strupper(SCSTR(string)) |
643 |
859 |
644 /** |
860 /** |
645 * Returns a upper case version of a string. |
861 * Returns a upper case version of a string. |
646 * |
862 * |
647 * This function creates a duplicate of the input string, first. See the |
863 * This function creates a duplicate of the input string, first. See the |
648 * documentation of sstrdup_a() for the implications. |
864 * documentation of scstrdup_a() for the implications. |
649 * |
865 * |
650 * @param allocator the allocator used for duplicating the string |
866 * @param allocator the allocator used for duplicating the string |
651 * @param string the input string |
867 * @param string the input string |
652 * @return the resulting upper case string |
868 * @return the resulting upper case string |
653 * @see sstrdup_a() |
869 * @see scstrdup_a() |
654 */ |
870 */ |
655 sstr_t ucx_strupper_a(UcxAllocator *allocator, scstr_t string); |
871 sstr_t ucx_strupper_a(UcxAllocator *allocator, scstr_t string); |
656 |
872 |
|
873 /** |
|
874 * Alias for ucx_strupper_a() which automatically casts the argument. |
|
875 * |
|
876 * @param allocator the allocator used for duplicating the string |
|
877 * @param string the input string |
|
878 * @return the resulting upper case string |
|
879 */ |
657 #define sstrupper_a(allocator, string) ucx_strupper_a(allocator, string) |
880 #define sstrupper_a(allocator, string) ucx_strupper_a(allocator, string) |
658 |
881 |
659 #ifdef __cplusplus |
882 #ifdef __cplusplus |
660 } |
883 } |
661 #endif |
884 #endif |