2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = glib-String-Utility-Functions.html
48 * - GString* -> StringG
59 import tango
.io
.Stdout
; // use the tango loging?
63 private import gtkc
.glibtypes
;
65 private import gtkc
.glib
;
68 private import glib
.StringG
;
72 private import tango
.stdc
.stdio
;
73 private import tango
.stdc
.string
;
75 private import std
.stdio
;
76 private import std
.c
.string
;
84 * This section describes a number of utility functions for creating,
85 * duplicating, and manipulating strings.
86 * Note that the functions g_printf(), g_fprintf(), g_sprintf(), g_snprintf(),
87 * g_vprintf(), g_vfprintf(), g_vsprintf() and g_vsnprintf() are declared in
88 * the header gprintf.h which is not
89 * included in glib.h (otherwise using
90 * glib.h would drag in stdio.h), so
91 * you'll have to explicitly include <glib/gprintf.h>
92 * in order to use the GLib printf() functions.
93 * While you may use the printf() functions to format UTF-8 strings, notice that
94 * the precision of a %Ns parameter is interpreted as the
95 * number of bytes, not characters to print.
96 * On top of that, the GNU libc implementation of the printf() functions has the "feature"
97 * that it checks that the string given for the %Ns parameter
98 * consists of a whole number of characters in the current encoding. So, unless you
99 * are sure you are always going to be in an UTF-8 locale or your know your text is restricted
100 * to ASCII, avoid using %Ns.
101 * If your intention is to format strings for a certain number of columns, then
102 * %Ns is not a correct solution anyway, since it fails to take
103 * wide characters (see g_unichar_iswide()) into account.
108 const static char[10] digits
= "0123456789"; /// 0..9
110 /*************************************************
111 * Convert C-style 0 terminated string s to char[] string.
114 public static char[] toString(char *s
)
116 return s ? s
[0 .. strlen(s
)] : cast(char[])null;
119 /*********************************
120 * Convert array of chars s[] to a C-style 0 terminated string.
123 public static char* toStringz(char[] s
)
131 // // TODO this one fails in some case???
132 // assert(strlen(result) == s.length);
133 // assert(memcmp(result, s, s.length) == 0);
146 // Need to make a copy
147 copy
= new char[s
.length
+ 1];
148 copy
[0..s
.length
] = s
;
155 public static char** toStringzArray(char[][] args
)
161 char** argv
= (new char*[args
.length
]).ptr
;
163 foreach (char[] p
; args
)
165 argv
[argc
++] = cast(char*)(p
~'\0');
172 public static char[][] toStringArray(char** args
)
182 while( (arg
) != null && i
<10)
184 argv
~= toString(arg
);
192 public static char[] toString(bool b
)
194 return b ?
"true" : "false";
197 public static char[] toString(char c
)
199 char[] result
= new char[2];
202 return result
[0 .. 1];
205 public static char[] toString(ubyte ub
) { return toString(cast(uint) ub
); } /// ditto
206 public static char[] toString(ushort us
) { return toString(cast(uint) us
); } /// ditto
208 public static char[] toString(uint u
)
209 { char[uint.sizeof
* 3] buffer
= void;
216 // Avoid storage allocation for simple stuff
217 result
= digits
[u
.. u
+ 1];
225 buffer
[buffer
.length
- ndigits
] = c
;
227 result
= new char[ndigits
];
228 result
[] = buffer
[buffer
.length
- ndigits
.. buffer
.length
];
233 public static char[] toString(ulong u
)
234 { char[ulong.sizeof
* 3] buffer
;
239 if (u
< 0x1_0000_0000)
240 return toString(cast(uint)u
);
247 buffer
[buffer
.length
- ndigits
] = c
;
249 result
= new char[ndigits
];
250 result
[] = buffer
[buffer
.length
- ndigits
.. buffer
.length
];
254 public static char[] toString(byte b
) { return toString(cast(int) b
); } /// ditto
255 public static char[] toString(short s
) { return toString(cast(int) s
); } /// ditto
257 public static char[] toString(int i
)
258 { char[1 + int.sizeof
* 3] buffer
;
263 return toString(cast(uint)i
);
271 buffer
[buffer
.length
- ndigits
] = c
;
274 buffer
[buffer
.length
- ndigits
] = '-';
275 result
= new char[ndigits
];
276 result
[] = buffer
[buffer
.length
- ndigits
.. buffer
.length
];
284 * Duplicates a string.
285 * If str is NULL it returns NULL.
286 * The returned string should be freed when no longer needed.
288 * the string to duplicate.
290 * a newly-allocated copy of str.
292 public static char[] strdup(char[] str)
294 // gchar* g_strdup (const gchar *str);
295 return Str
.toString(g_strdup(Str
.toStringz(str)) );
299 * Duplicates the first n bytes of a string, returning a newly-allocated
300 * buffer n + 1 bytes long which will always be nul-terminated.
301 * If str is less than n bytes long the buffer is padded with nuls.
302 * If str is NULL it returns NULL.
303 * The returned value should be freed when no longer needed.
305 * To copy a number of characters from a UTF-8 encoded string, use
306 * g_utf8_strncpy() instead.
308 * the string to duplicate
310 * the maximum number of bytes to copy from str
312 * a newly-allocated buffer containing the first n bytes
313 * of str, nul-terminated
315 public static char[] strndup(char[] str, uint n
)
317 // gchar* g_strndup (const gchar *str, gsize n);
318 return Str
.toString(g_strndup(Str
.toStringz(str), n
) );
322 * Copies NULL-terminated array of strings. The copy is a deep copy;
323 * the new array should be freed by first freeing each string, then
324 * the array itself. g_strfreev() does this for you. If called
325 * on a NULL value, g_strdupv() simply returns NULL.
327 * NULL-terminated array of strings.
329 * a new NULL-terminated array of strings.
331 public static char** strdupv(char** strArray
)
333 // gchar** g_strdupv (gchar **str_array);
334 return g_strdupv(strArray
);
338 * Creates a new string length bytes long filled with fill_char.
339 * The returned string should be freed when no longer needed.
341 * the length of the new string
343 * the byte to fill the string with
345 * a newly-allocated string filled the fill_char
347 public static char[] strnfill(uint length
, char fillChar
)
349 // gchar* g_strnfill (gsize length, gchar fill_char);
350 return Str
.toString(g_strnfill(length
, fillChar
) );
354 * Copies a nul-terminated string into the dest buffer, include the
355 * trailing nul, and return a pointer to the trailing nul byte.
356 * This is useful for concatenating multiple strings together
357 * without having to repeatedly scan for the end.
359 * destination buffer.
363 * a pointer to trailing nul byte.
365 public static char[] stpcpy(char[] dest
, char[] src
)
367 // gchar* g_stpcpy (gchar *dest, const char *src);
368 return Str
.toString(g_stpcpy(Str
.toStringz(dest
), Str
.toStringz(src
)) );
372 * Searches the string haystack for the first occurrence
373 * of the string needle, limiting the length of the search
378 * the maximum length of haystack.
380 * the string to search for.
382 * a pointer to the found occurrence, or
385 public static char[] strstrLen(char[] haystack
, int haystackLen
, char[] needle
)
387 // gchar* g_strstr_len (const gchar *haystack, gssize haystack_len, const gchar *needle);
388 return Str
.toString(g_strstr_len(Str
.toStringz(haystack
), haystackLen
, Str
.toStringz(needle
)) );
392 * Searches the string haystack for the last occurrence
393 * of the string needle.
395 * a nul-terminated string.
397 * the nul-terminated string to search for.
399 * a pointer to the found occurrence, or
402 public static char[] strrstr(char[] haystack
, char[] needle
)
404 // gchar* g_strrstr (const gchar *haystack, const gchar *needle);
405 return Str
.toString(g_strrstr(Str
.toStringz(haystack
), Str
.toStringz(needle
)) );
409 * Searches the string haystack for the last occurrence
410 * of the string needle, limiting the length of the search
413 * a nul-terminated string.
415 * the maximum length of haystack.
417 * the nul-terminated string to search for.
419 * a pointer to the found occurrence, or
422 public static char[] strrstrLen(char[] haystack
, int haystackLen
, char[] needle
)
424 // gchar* g_strrstr_len (const gchar *haystack, gssize haystack_len, const gchar *needle);
425 return Str
.toString(g_strrstr_len(Str
.toStringz(haystack
), haystackLen
, Str
.toStringz(needle
)) );
429 * Looks whether the string str begins with prefix.
431 * a nul-terminated string.
433 * the nul-terminated prefix to look for.
435 * TRUE if str begins with prefix, FALSE otherwise.
438 public static int strHasPrefix(char[] str, char[] prefix
)
440 // gboolean g_str_has_prefix (const gchar *str, const gchar *prefix);
441 return g_str_has_prefix(Str
.toStringz(str), Str
.toStringz(prefix
));
445 * Looks whether the string str ends with suffix.
447 * a nul-terminated string.
449 * the nul-terminated suffix to look for.
451 * TRUE if str end with suffix, FALSE otherwise.
454 public static int strHasSuffix(char[] str, char[] suffix
)
456 // gboolean g_str_has_suffix (const gchar *str, const gchar *suffix);
457 return g_str_has_suffix(Str
.toStringz(str), Str
.toStringz(suffix
));
461 * Portability wrapper that calls strlcpy() on systems which have it, and emulates
462 * strlcpy() otherwise. Copies src to dest; dest is guaranteed to be
463 * nul-terminated; src must be nul-terminated; dest_size is the buffer size, not
464 * the number of chars to copy. Caveat: strlcpy() is supposedly more secure than
465 * strcpy() or strncpy(), but if you really want to avoid screwups, g_strdup() is
466 * an even better idea.
472 * length of dest in bytes
476 public static uint strlcpy(char[] dest
, char[] src
, uint destSize
)
478 // gsize g_strlcpy (gchar *dest, const gchar *src, gsize dest_size);
479 return g_strlcpy(Str
.toStringz(dest
), Str
.toStringz(src
), destSize
);
483 * Portability wrapper that calls strlcat() on systems which have it, and emulates it otherwise.
484 * Appends nul-terminated src string to dest, guaranteeing
485 * nul-termination for dest. The total size of dest won't exceed
486 * dest_size. Caveat: this is supposedly a more secure alternative to strcat() or
487 * strncat(), but for real security g_strconcat() is harder to mess up.
489 * destination buffer, already containing one nul-terminated string
493 * length of dest buffer in bytes (not length of existing string inside dest)
495 * length of src plus initial length of string in dest
497 public static uint strlcat(char[] dest
, char[] src
, uint destSize
)
499 // gsize g_strlcat (gchar *dest, const gchar *src, gsize dest_size);
500 return g_strlcat(Str
.toStringz(dest
), Str
.toStringz(src
), destSize
);
504 * Similar to the standard C sprintf() function
505 * but safer, since it calculates the maximum space required and allocates
506 * memory to hold the result.
507 * The returned string should be freed when no longer needed.
509 * a standard printf() format string, but notice
510 * string precision pitfalls.
512 * the parameters to insert into the format string.
514 * a newly-allocated string holding the result.
516 public static char[] strdupPrintf(char[] format
, ... )
518 // gchar* g_strdup_printf (const gchar *format, ...);
519 return Str
.toString(g_strdup_printf(Str
.toStringz(format
)) );
523 * Similar to the standard C vsprintf() function
524 * but safer, since it calculates the maximum space required and allocates
525 * memory to hold the result.
526 * The returned string should be freed when no longer needed.
527 * See also g_vasprintf(), which offers the same functionality, but additionally
528 * returns the length of the allocated string.
530 * a standard printf() format string, but notice
531 * string precision pitfalls.
533 * the list of parameters to insert into the format string.
535 * a newly-allocated string holding the result.
537 public static char[] strdupVprintf(char[] format
, void* args
)
539 // gchar* g_strdup_vprintf (const gchar *format, va_list args);
540 return Str
.toString(g_strdup_vprintf(Str
.toStringz(format
), args
) );
544 * An implementation of the standard printf() function which supports
545 * positional parameters, as specified in the Single Unix Specification.
547 * a standard printf() format string, but notice
548 * string precision pitfalls.
550 * the arguments to insert in the output.
552 * the number of characters printed.
555 public static int printf(char[] format
, ... )
557 // gint g_printf (gchar const *format, ...);
558 return g_printf(Str
.toStringz(format
));
562 * An implementation of the standard vprintf() function which supports
563 * positional parameters, as specified in the Single Unix Specification.
565 * a standard printf() format string, but notice
566 * string precision pitfalls.
568 * the list of arguments to insert in the output.
570 * the number of characters printed.
573 public static int vprintf(char[] format
, void* args
)
575 // gint g_vprintf (gchar const *format, va_list args);
576 return g_vprintf(Str
.toStringz(format
), args
);
580 * An implementation of the standard fprintf() function which supports
581 * positional parameters, as specified in the Single Unix Specification.
583 * the stream to write to.
585 * a standard printf() format string, but notice
586 * string precision pitfalls.
588 * the arguments to insert in the output.
590 * the number of characters printed.
593 public static int fprintf(FILE
* file
, char[] format
, ... )
595 // gint g_fprintf (FILE *file, gchar const *format, ...);
596 return g_fprintf(file
, Str
.toStringz(format
));
600 * An implementation of the standard fprintf() function which supports
601 * positional parameters, as specified in the Single Unix Specification.
603 * the stream to write to.
605 * a standard printf() format string, but notice
606 * string precision pitfalls.
608 * the list of arguments to insert in the output.
610 * the number of characters printed.
613 public static int vfprintf(FILE
* file
, char[] format
, void* args
)
615 // gint g_vfprintf (FILE *file, gchar const *format, va_list args);
616 return g_vfprintf(file
, Str
.toStringz(format
), args
);
620 * An implementation of the standard sprintf() function which supports
621 * positional parameters, as specified in the Single Unix Specification.
623 * A pointer to a memory buffer to contain the resulting string. It
624 * is up to the caller to ensure that the allocated buffer is large
625 * enough to hold the formatted result
627 * a standard printf() format string, but notice
628 * string precision pitfalls.
630 * the arguments to insert in the output.
632 * the number of characters printed.
635 public static int sprintf(char[] string
, char[] format
, ... )
637 // gint g_sprintf (gchar *string, gchar const *format, ...);
638 return g_sprintf(Str
.toStringz(string
), Str
.toStringz(format
));
642 * An implementation of the standard vsprintf() function which supports
643 * positional parameters, as specified in the Single Unix Specification.
645 * the buffer to hold the output.
647 * a standard printf() format string, but notice
648 * string precision pitfalls.
650 * the list of arguments to insert in the output.
652 * the number of characters printed.
655 public static int vsprintf(char[] string
, char[] format
, void* args
)
657 // gint g_vsprintf (gchar *string, gchar const *format, va_list args);
658 return g_vsprintf(Str
.toStringz(string
), Str
.toStringz(format
), args
);
662 * A safer form of the standard sprintf() function. The output is guaranteed
663 * to not exceed n characters (including the terminating nul character), so
664 * it is easy to ensure that a buffer overflow cannot occur.
665 * See also g_strdup_printf().
666 * In versions of GLib prior to 1.2.3, this function may return -1 if the
667 * output was truncated, and the truncated string may not be nul-terminated.
668 * In versions prior to 1.3.12, this function returns the length of the output
670 * The return value of g_snprintf() conforms to the snprintf()
671 * function as standardized in ISO C99. Note that this is different from
672 * traditional snprintf(), which returns the length of the output string.
673 * The format string may contain positional parameters, as specified in
674 * the Single Unix Specification.
676 * the buffer to hold the output.
678 * the maximum number of characters to produce (including the
679 * terminating nul character).
681 * a standard printf() format string, but notice
682 * string precision pitfalls.
684 * the arguments to insert in the output.
686 * the number of characters which would be produced if the buffer
689 public static int snprintf(char[] string
, uint n
, char[] format
, ... )
691 // gint g_snprintf (gchar *string, gulong n, gchar const *format, ...);
692 return g_snprintf(Str
.toStringz(string
), n
, Str
.toStringz(format
));
696 * A safer form of the standard vsprintf() function. The output is guaranteed
697 * to not exceed n characters (including the terminating nul character), so
698 * it is easy to ensure that a buffer overflow cannot occur.
699 * See also g_strdup_vprintf().
700 * In versions of GLib prior to 1.2.3, this function may return -1 if the
701 * output was truncated, and the truncated string may not be nul-terminated.
702 * In versions prior to 1.3.12, this function returns the length of the output
704 * The return value of g_vsnprintf() conforms to the vsnprintf() function
705 * as standardized in ISO C99. Note that this is different from traditional
706 * vsnprintf(), which returns the length of the output string.
707 * The format string may contain positional parameters, as specified in
708 * the Single Unix Specification.
710 * the buffer to hold the output.
712 * the maximum number of characters to produce (including the
713 * terminating nul character).
715 * a standard printf() format string, but notice
716 * string precision pitfalls.
718 * the list of arguments to insert in the output.
720 * the number of characters which would be produced if the buffer
723 public static int vsnprintf(char[] string
, uint n
, char[] format
, void* args
)
725 // gint g_vsnprintf (gchar *string, gulong n, gchar const *format, va_list args);
726 return g_vsnprintf(Str
.toStringz(string
), n
, Str
.toStringz(format
), args
);
730 * An implementation of the GNU vasprintf() function which supports
731 * positional parameters, as specified in the Single Unix Specification.
732 * This function is similar to g_vsprintf(), except that it allocates a
733 * string to hold the output, instead of putting the output in a buffer
734 * you allocate in advance.
736 * the return location for the newly-allocated string.
738 * a standard printf() format string, but notice
739 * string precision pitfalls.
741 * the list of arguments to insert in the output.
743 * the number of characters printed.
746 public static int vasprintf(char** string
, char[] format
, void* args
)
748 // gint g_vasprintf (gchar **string, gchar const *format, va_list args);
749 return g_vasprintf(string
, Str
.toStringz(format
), args
);
753 * Calculates the maximum space needed to store the output of the sprintf() function.
755 * the format string. See the printf() documentation.
757 * the parameters to be inserted into the format string.
759 * the maximum space needed to store the formatted string.
761 public static uint printfStringUpperBound(char[] format
, void* args
)
763 // gsize g_printf_string_upper_bound (const gchar *format, va_list args);
764 return g_printf_string_upper_bound(Str
.toStringz(format
), args
);
768 * Determines whether a character is alphanumeric.
769 * Unlike the standard C library isalnum() function, this only
770 * recognizes standard ASCII letters and ignores the locale, returning
771 * FALSE for all non-ASCII characters. Also unlike the standard
772 * library function, this takes a char, not an int,
773 * so don't call it on EOF but no need to cast to guchar before passing a
774 * possibly non-ASCII character in.
778 * TRUE if c is an ASCII alphanumeric character
780 public static int asciiIsalnum(char c
)
782 // gboolean g_ascii_isalnum (gchar c);
783 return g_ascii_isalnum(c
);
787 * Determines whether a character is alphabetic (i.e. a letter).
788 * Unlike the standard C library isalpha() function, this only
789 * recognizes standard ASCII letters and ignores the locale, returning
790 * FALSE for all non-ASCII characters. Also unlike the standard
791 * library function, this takes a char, not an int,
792 * so don't call it on EOF but no need to cast to guchar before passing a
793 * possibly non-ASCII character in.
797 * TRUE if c is an ASCII alphabetic character
799 public static int asciiIsalpha(char c
)
801 // gboolean g_ascii_isalpha (gchar c);
802 return g_ascii_isalpha(c
);
806 * Determines whether a character is a control character.
807 * Unlike the standard C library iscntrl() function, this only
808 * recognizes standard ASCII control characters and ignores the locale,
809 * returning FALSE for all non-ASCII characters. Also unlike the standard
810 * library function, this takes a char, not an int,
811 * so don't call it on EOF but no need to cast to guchar before passing a
812 * possibly non-ASCII character in.
816 * TRUE if c is an ASCII control character.
818 public static int asciiIscntrl(char c
)
820 // gboolean g_ascii_iscntrl (gchar c);
821 return g_ascii_iscntrl(c
);
825 * Determines whether a character is digit (0-9).
826 * Unlike the standard C library isdigit() function,
827 * this takes a char, not an int, so don't call it
828 * on EOF but no need to cast to guchar before passing a possibly
829 * non-ASCII character in.
833 * TRUE if c is an ASCII digit.
835 public static int asciiIsdigit(char c
)
837 // gboolean g_ascii_isdigit (gchar c);
838 return g_ascii_isdigit(c
);
842 * Determines whether a character is a printing character and not a space.
843 * Unlike the standard C library isgraph() function,
844 * this only recognizes standard ASCII characters and ignores the locale,
845 * returning FALSE for all non-ASCII characters. Also unlike the standard
846 * library function, this takes a char, not an int,
847 * so don't call it on EOF but no need to cast to guchar before passing a
848 * possibly non-ASCII character in.
852 * TRUE if c is an ASCII printing character other than space.
854 public static int asciiIsgraph(char c
)
856 // gboolean g_ascii_isgraph (gchar c);
857 return g_ascii_isgraph(c
);
861 * Determines whether a character is an ASCII lower case letter.
862 * Unlike the standard C library islower() function,
863 * this only recognizes standard ASCII letters and ignores the locale,
864 * returning FALSE for all non-ASCII characters. Also unlike the standard
865 * library function, this takes a char, not an int,
866 * so don't call it on EOF but no need to worry about casting to guchar
867 * before passing a possibly non-ASCII character in.
871 * TRUE if c is an ASCII lower case letter
873 public static int asciiIslower(char c
)
875 // gboolean g_ascii_islower (gchar c);
876 return g_ascii_islower(c
);
880 * Determines whether a character is a printing character.
881 * Unlike the standard C library isprint() function,
882 * this only recognizes standard ASCII characters and ignores the locale,
883 * returning FALSE for all non-ASCII characters. Also unlike the standard
884 * library function, this takes a char, not an int,
885 * so don't call it on EOF but no need to cast to guchar before passing a
886 * possibly non-ASCII character in.
890 * TRUE if c is an ASCII printing character.
892 public static int asciiIsprint(char c
)
894 // gboolean g_ascii_isprint (gchar c);
895 return g_ascii_isprint(c
);
899 * Determines whether a character is a punctuation character.
900 * Unlike the standard C library ispunct() function,
901 * this only recognizes standard ASCII letters and ignores the locale,
902 * returning FALSE for all non-ASCII characters. Also unlike the standard
903 * library function, this takes a char, not an int,
904 * so don't call it on EOF but no need to cast to guchar before passing a
905 * possibly non-ASCII character in.
909 * TRUE if c is an ASCII punctuation character.
911 public static int asciiIspunct(char c
)
913 // gboolean g_ascii_ispunct (gchar c);
914 return g_ascii_ispunct(c
);
918 * Determines whether a character is a white-space character.
919 * Unlike the standard C library isspace() function,
920 * this only recognizes standard ASCII white-space and ignores the locale,
921 * returning FALSE for all non-ASCII characters. Also unlike the standard
922 * library function, this takes a char, not an int,
923 * so don't call it on EOF but no need to cast to guchar before passing a
924 * possibly non-ASCII character in.
928 * TRUE if c is an ASCII white-space character
930 public static int asciiIsspace(char c
)
932 // gboolean g_ascii_isspace (gchar c);
933 return g_ascii_isspace(c
);
937 * Determines whether a character is an ASCII upper case letter.
938 * Unlike the standard C library isupper() function,
939 * this only recognizes standard ASCII letters and ignores the locale,
940 * returning FALSE for all non-ASCII characters. Also unlike the standard
941 * library function, this takes a char, not an int,
942 * so don't call it on EOF but no need to worry about casting to guchar
943 * before passing a possibly non-ASCII character in.
947 * TRUE if c is an ASCII upper case letter
949 public static int asciiIsupper(char c
)
951 // gboolean g_ascii_isupper (gchar c);
952 return g_ascii_isupper(c
);
956 * Determines whether a character is a hexadecimal-digit character.
957 * Unlike the standard C library isxdigit() function,
958 * this takes a char, not an int, so
959 * don't call it on EOF but no need to cast to guchar before passing a
960 * possibly non-ASCII character in.
964 * TRUE if c is an ASCII hexadecimal-digit character.
966 public static int asciiIsxdigit(char c
)
968 // gboolean g_ascii_isxdigit (gchar c);
969 return g_ascii_isxdigit(c
);
973 * Determines the numeric value of a character as a decimal
974 * digit. Differs from g_unichar_digit_value() because it takes
975 * a char, so there's no worry about sign extension if characters
978 * an ASCII character.
980 * If c is a decimal digit (according to
981 * g_ascii_isdigit()), its numeric value. Otherwise, -1.
983 public static int asciiDigitValue(char c
)
985 // gint g_ascii_digit_value (gchar c);
986 return g_ascii_digit_value(c
);
990 * Determines the numeric value of a character as a hexidecimal
991 * digit. Differs from g_unichar_xdigit_value() because it takes
992 * a char, so there's no worry about sign extension if characters
995 * an ASCII character.
997 * If c is a hex digit (according to
998 * g_ascii_isxdigit()), its numeric value. Otherwise, -1.
1000 public static int asciiXdigitValue(char c
)
1002 // gint g_ascii_xdigit_value (gchar c);
1003 return g_ascii_xdigit_value(c
);
1007 * Compare two strings, ignoring the case of ASCII characters.
1008 * Unlike the BSD strcasecmp() function, this only recognizes standard
1009 * ASCII letters and ignores the locale, treating all non-ASCII
1010 * bytes as if they are not letters.
1011 * This function should be used only on strings that are known to be
1012 * in encodings where the bytes corresponding to ASCII letters always
1013 * represent themselves. This includes UTF-8 and the ISO-8859-*
1014 * charsets, but not for instance double-byte encodings like the
1015 * Windows Codepage 932, where the trailing bytes of double-byte
1016 * characters include all ASCII letters. If you compare two CP932
1017 * strings using this function, you will get false matches.
1019 * string to compare with s2.
1021 * string to compare with s1.
1023 * 0 if the strings match, a negative value if s1 < s2,
1024 * or a positive value if s1 > s2.
1026 public static int asciiStrcasecmp(char[] s1
, char[] s2
)
1028 // gint g_ascii_strcasecmp (const gchar *s1, const gchar *s2);
1029 return g_ascii_strcasecmp(Str
.toStringz(s1
), Str
.toStringz(s2
));
1033 * Compare s1 and s2, ignoring the case of ASCII characters and any
1034 * characters after the first n in each string.
1035 * Unlike the BSD strcasecmp() function, this only recognizes standard
1036 * ASCII letters and ignores the locale, treating all non-ASCII
1037 * characters as if they are not letters.
1038 * The same warning as in g_ascii_strcasecmp() applies: Use this
1039 * function only on strings known to be in encodings where bytes
1040 * corresponding to ASCII letters always represent themselves.
1042 * string to compare with s2.
1044 * string to compare with s1.
1046 * number of characters to compare.
1048 * 0 if the strings match, a negative value if s1 < s2,
1049 * or a positive value if s1 > s2.
1051 public static int asciiStrncasecmp(char[] s1
, char[] s2
, uint n
)
1053 // gint g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n);
1054 return g_ascii_strncasecmp(Str
.toStringz(s1
), Str
.toStringz(s2
), n
);
1058 * Converts all lower case ASCII letters to upper case ASCII letters.
1062 * length of str in bytes, or -1 if str is nul-terminated.
1064 * a newly allocated string, with all the lower case
1065 * characters in str converted to upper case, with
1066 * semantics that exactly match g_ascii_toupper(). (Note
1067 * that this is unlike the old g_strup(), which modified
1068 * the string in place.)
1070 public static char[] asciiStrup(char[] str, int len
)
1072 // gchar* g_ascii_strup (const gchar *str, gssize len);
1073 return Str
.toString(g_ascii_strup(Str
.toStringz(str), len
) );
1077 * Converts all upper case ASCII letters to lower case ASCII letters.
1081 * length of str in bytes, or -1 if str is nul-terminated.
1083 * a newly-allocated string, with all the upper case
1084 * characters in str converted to lower case, with
1085 * semantics that exactly match g_ascii_tolower(). (Note
1086 * that this is unlike the old g_strdown(), which modified
1087 * the string in place.)
1089 public static char[] asciiStrdown(char[] str, int len
)
1091 // gchar* g_ascii_strdown (const gchar *str, gssize len);
1092 return Str
.toString(g_ascii_strdown(Str
.toStringz(str), len
) );
1096 * Convert a character to ASCII lower case.
1097 * Unlike the standard C library tolower() function, this only
1098 * recognizes standard ASCII letters and ignores the locale, returning
1099 * all non-ASCII characters unchanged, even if they are lower case
1100 * letters in a particular character set. Also unlike the standard
1101 * library function, this takes and returns a char, not an int, so
1102 * don't call it on EOF but no need to worry about casting to guchar
1103 * before passing a possibly non-ASCII character in.
1107 * the result of converting c to lower case.
1108 * If c is not an ASCII upper case letter,
1109 * c is returned unchanged.
1111 public static char asciiTolower(char c
)
1113 // gchar g_ascii_tolower (gchar c);
1114 return g_ascii_tolower(c
);
1118 * Convert a character to ASCII upper case.
1119 * Unlike the standard C library toupper() function, this only
1120 * recognizes standard ASCII letters and ignores the locale, returning
1121 * all non-ASCII characters unchanged, even if they are upper case
1122 * letters in a particular character set. Also unlike the standard
1123 * library function, this takes and returns a char, not an int, so
1124 * don't call it on EOF but no need to worry about casting to guchar
1125 * before passing a possibly non-ASCII character in.
1129 * the result of converting c to upper case.
1130 * If c is not an ASCII lower case letter,
1131 * c is returned unchanged.
1133 public static char asciiToupper(char c
)
1135 // gchar g_ascii_toupper (gchar c);
1136 return g_ascii_toupper(c
);
1140 * Converts all lower case ASCII letters to upper case ASCII letters.
1144 * passed-in string pointer, with all the lower case
1145 * characters converted to upper case in place, with
1146 * semantics that exactly match g_ascii_toupper.
1148 public static StringG
stringAsciiUp(StringG string
)
1150 // GString* g_string_ascii_up (GString *string);
1151 return new StringG( g_string_ascii_up((string
is null) ?
null : string
.getStringGStruct()) );
1155 * Converts all upper case ASCII letters to lower case ASCII letters.
1159 * passed-in string pointer, with all the upper case
1160 * characters converted to lower case in place, with
1161 * semantics that exactly match g_ascii_tolower.
1163 public static StringG
stringAsciiDown(StringG string
)
1165 // GString* g_string_ascii_down (GString *string);
1166 return new StringG( g_string_ascii_down((string
is null) ?
null : string
.getStringGStruct()) );
1171 * g_strup has been deprecated since version 2.2 and should not be used in newly-written code. This function is totally broken for the reasons discussed
1172 * in the g_strncasecmp() docs - use g_ascii_strup() or g_utf8_strup() instead.
1173 * Converts a string to upper case.
1175 * the string to convert.
1179 public static char[] strup(char[] string
)
1181 // gchar* g_strup (gchar *string);
1182 return Str
.toString(g_strup(Str
.toStringz(string
)) );
1187 * g_strdown has been deprecated since version 2.2 and should not be used in newly-written code. This function is totally broken for the reasons discussed
1188 * in the g_strncasecmp() docs - use g_ascii_strdown() or g_utf8_strdown()
1190 * Converts a string to lower case.
1192 * the string to convert.
1196 public static char[] strdown(char[] string
)
1198 // gchar* g_strdown (gchar *string);
1199 return Str
.toString(g_strdown(Str
.toStringz(string
)) );
1204 * g_strcasecmp has been deprecated since version 2.2 and should not be used in newly-written code. See g_strncasecmp() for a discussion of why this function
1205 * is deprecated and how to replace it.
1206 * A case-insensitive string comparison, corresponding to the standard
1207 * strcasecmp() function on platforms which support it.
1211 * a string to compare with s1.
1213 * 0 if the strings match, a negative value if s1 < s2,
1214 * or a positive value if s1 > s2.
1216 public static int strcasecmp(char[] s1
, char[] s2
)
1218 // gint g_strcasecmp (const gchar *s1, const gchar *s2);
1219 return g_strcasecmp(Str
.toStringz(s1
), Str
.toStringz(s2
));
1224 * g_strncasecmp has been deprecated since version 2.2 and should not be used in newly-written code. The problem with g_strncasecmp() is that it does the
1225 * comparison by calling toupper()/tolower(). These functions are
1226 * locale-specific and operate on single bytes. However, it is impossible
1227 * to handle things correctly from an I18N standpoint by operating on
1228 * bytes, since characters may be multibyte. Thus g_strncasecmp() is
1229 * broken if your string is guaranteed to be ASCII, since it's
1230 * locale-sensitive, and it's broken if your string is localized, since
1231 * it doesn't work on many encodings at all, including UTF-8, EUC-JP,
1233 * There are therefore two replacement functions: g_ascii_strncasecmp(),
1234 * which only works on ASCII and is not locale-sensitive, and
1235 * g_utf8_casefold(), which is good for case-insensitive sorting of UTF-8.
1236 * A case-insensitive string comparison, corresponding to the standard
1237 * strncasecmp() function on platforms which support it.
1238 * It is similar to g_strcasecmp() except it only compares the first n
1239 * characters of the strings.
1243 * a string to compare with s1.
1245 * the maximum number of characters to compare.
1247 * 0 if the strings match, a negative value if s1 < s2,
1248 * or a positive value if s1 > s2.
1250 public static int strncasecmp(char[] s1
, char[] s2
, uint n
)
1252 // gint g_strncasecmp (const gchar *s1, const gchar *s2, guint n);
1253 return g_strncasecmp(Str
.toStringz(s1
), Str
.toStringz(s2
), n
);
1257 * Reverses all of the bytes in a string.
1258 * For example, g_strreverse ("abcdef") will result in "fedcba".
1259 * Note that g_strreverse() doesn't work on UTF-8 strings containing multibyte characters.
1260 * For that purpose, use g_utf8_strreverse().
1262 * the string to reverse.
1264 * the same pointer passed in as string.
1266 public static char[] strreverse(char[] string
)
1268 // gchar* g_strreverse (gchar *string);
1269 return Str
.toString(g_strreverse(Str
.toStringz(string
)) );
1273 * Converts a string to a gint64 value.
1274 * This function behaves like the standard strtoll() function
1275 * does in the C locale. It does this without actually
1276 * changing the current locale, since that would not be
1278 * This function is typically used when reading configuration
1279 * files or other non-user input that should be locale independent.
1280 * To handle input from the user you should normally use the
1281 * locale-sensitive system strtoll() function.
1282 * If the correct value would cause overflow, G_MAXINT64 or G_MININT64
1283 * is returned, and ERANGE is stored in errno. If the base is
1284 * outside the valid range, zero is returned, and EINVAL is stored
1285 * in errno. If the string conversion fails, zero is returned, and
1286 * endptr returns nptr (if endptr is non-NULL).
1288 * the string to convert to a numeric value.
1290 * if non-NULL, it returns the character after
1291 * the last character used in the conversion.
1293 * to be used for the conversion, 2..36 or 0
1295 * the gint64 value or zero on error.
1298 public static long asciiStrtoll(char[] nptr
, char** endptr
, uint base
)
1300 // gint64 g_ascii_strtoll (const gchar *nptr, gchar **endptr, guint base);
1301 return g_ascii_strtoll(Str
.toStringz(nptr
), endptr
, base
);
1305 * Converts a string to a guint64 value.
1306 * This function behaves like the standard strtoull() function
1307 * does in the C locale. It does this without actually
1308 * changing the current locale, since that would not be
1310 * This function is typically used when reading configuration
1311 * files or other non-user input that should be locale independent.
1312 * To handle input from the user you should normally use the
1313 * locale-sensitive system strtoull() function.
1314 * If the correct value would cause overflow, G_MAXUINT64
1315 * is returned, and ERANGE is stored in errno. If the base is
1316 * outside the valid range, zero is returned, and EINVAL is stored
1317 * in errno. If the string conversion fails, zero is returned, and
1318 * endptr returns nptr (if endptr is non-NULL).
1320 * the string to convert to a numeric value.
1322 * if non-NULL, it returns the character after
1323 * the last character used in the conversion.
1325 * to be used for the conversion, 2..36 or 0
1327 * the guint64 value or zero on error.
1330 public static ulong asciiStrtoull(char[] nptr
, char** endptr
, uint base
)
1332 // guint64 g_ascii_strtoull (const gchar *nptr, gchar **endptr, guint base);
1333 return g_ascii_strtoull(Str
.toStringz(nptr
), endptr
, base
);
1338 * Converts a string to a gdouble value.
1339 * This function behaves like the standard strtod() function
1340 * does in the C locale. It does this without actually
1341 * changing the current locale, since that would not be
1343 * This function is typically used when reading configuration
1344 * files or other non-user input that should be locale independent.
1345 * To handle input from the user you should normally use the
1346 * locale-sensitive system strtod() function.
1347 * To convert from a gdouble to a string in a locale-insensitive
1348 * way, use g_ascii_dtostr().
1349 * If the correct value would cause overflow, plus or minus HUGE_VAL
1350 * is returned (according to the sign of the value), and ERANGE is
1351 * stored in errno. If the correct value would cause underflow,
1352 * zero is returned and ERANGE is stored in errno.
1353 * This function resets errno before calling strtod() so that
1354 * you can reliably detect overflow and underflow.
1356 * the string to convert to a numeric value.
1358 * if non-NULL, it returns the character after
1359 * the last character used in the conversion.
1361 * the gdouble value.
1363 public static double asciiStrtod(char[] nptr
, char** endptr
)
1365 // gdouble g_ascii_strtod (const gchar *nptr, gchar **endptr);
1366 return g_ascii_strtod(Str
.toStringz(nptr
), endptr
);
1370 * Converts a gdouble to a string, using the '.' as
1372 * This functions generates enough precision that converting
1373 * the string back using g_ascii_strtod() gives the same machine-number
1374 * (on machines with IEEE compatible 64bit doubles). It is
1375 * guaranteed that the size of the resulting string will never
1376 * be larger than G_ASCII_DTOSTR_BUF_SIZE bytes.
1378 * A buffer to place the resulting string in
1380 * The length of the buffer.
1382 * The gdouble to convert
1384 * The pointer to the buffer with the converted string.
1386 public static char[] asciiDtostr(char[] buffer
, int bufLen
, double d
)
1388 // gchar* g_ascii_dtostr (gchar *buffer, gint buf_len, gdouble d);
1389 return Str
.toString(g_ascii_dtostr(Str
.toStringz(buffer
), bufLen
, d
) );
1393 * Converts a gdouble to a string, using the '.' as
1394 * decimal point. To format the number you pass in
1395 * a printf()-style format string. Allowed conversion
1396 * specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'.
1397 * If you just want to want to serialize the value into a
1398 * string, use g_ascii_dtostr().
1400 * A buffer to place the resulting string in
1402 * The length of the buffer.
1404 * The printf()-style format to use for the
1405 * code to use for converting.
1407 * The gdouble to convert
1409 * The pointer to the buffer with the converted string.
1411 public static char[] asciiFormatd(char[] buffer
, int bufLen
, char[] format
, double d
)
1413 // gchar* g_ascii_formatd (gchar *buffer, gint buf_len, const gchar *format, gdouble d);
1414 return Str
.toString(g_ascii_formatd(Str
.toStringz(buffer
), bufLen
, Str
.toStringz(format
), d
) );
1418 * Converts a string to a gdouble value.
1419 * It calls the standard strtod() function to handle the conversion, but
1420 * if the string is not completely converted it attempts the conversion
1421 * again with g_ascii_strtod(), and returns the best match.
1422 * This function should seldomly be used. The normal situation when reading
1423 * numbers not for human consumption is to use g_ascii_strtod(). Only when
1424 * you know that you must expect both locale formatted and C formatted numbers
1425 * should you use this. Make sure that you don't pass strings such as comma
1426 * separated lists of values, since the commas may be interpreted as a decimal
1427 * point in some locales, causing unexpected results.
1429 * the string to convert to a numeric value.
1431 * if non-NULL, it returns the character after
1432 * the last character used in the conversion.
1434 * the gdouble value.
1436 public static double strtod(char[] nptr
, char** endptr
)
1438 // gdouble g_strtod (const gchar *nptr, gchar **endptr);
1439 return g_strtod(Str
.toStringz(nptr
), endptr
);
1443 * Removes leading whitespace from a string, by moving the rest of the
1444 * characters forward.
1445 * This function doesn't allocate or reallocate any memory; it modifies string
1446 * in place. The pointer to string is returned to allow the nesting of functions.
1447 * Also see g_strchomp() and g_strstrip().
1449 * a string to remove the leading whitespace from.
1453 public static char[] strchug(char[] string
)
1455 // gchar* g_strchug (gchar *string);
1456 return Str
.toString(g_strchug(Str
.toStringz(string
)) );
1460 * Removes trailing whitespace from a string.
1461 * This function doesn't allocate or reallocate any memory; it modifies string in
1462 * place. The pointer to string is returned to allow the nesting of functions.
1463 * Also see g_strchug() and g_strstrip().
1465 * a string to remove the trailing whitespace from.
1469 public static char[] strchomp(char[] string
)
1471 // gchar* g_strchomp (gchar *string);
1472 return Str
.toString(g_strchomp(Str
.toStringz(string
)) );
1477 * Converts any delimiter characters in string to new_delimiter.
1478 * Any characters in string which are found in delimiters are changed
1479 * to the new_delimiter character. Modifies string in place, and returns
1480 * string itself, not a copy. The return value is to allow nesting such as
1481 * g_ascii_strup (g_strdelimit (str, "abc", '?')).
1483 * the string to convert.
1485 * a string containing the current delimiters, or NULL to use the
1486 * standard delimiters defined in G_STR_DELIMITERS.
1488 * the new delimiter character.
1492 public static char[] strdelimit(char[] string
, char[] delimiters
, char newDelimiter
)
1494 // gchar* g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter);
1495 return Str
.toString(g_strdelimit(Str
.toStringz(string
), Str
.toStringz(delimiters
), newDelimiter
) );
1500 * Escapes the special characters '\b', '\f', '\n', '\r', '\t', '\' and
1501 * '"' in the string source by inserting a '\' before
1502 * them. Additionally all characters in the range 0x01-0x1F (everything
1503 * below SPACE) and in the range 0x7F-0xFF (all non-ASCII chars) are
1504 * replaced with a '\' followed by their octal representation. Characters
1505 * supplied in exceptions are not escaped.
1506 * g_strcompress() does the reverse conversion.
1508 * a string to escape.
1510 * a string of characters not to escape in source.
1512 * a newly-allocated copy of source with certain
1513 * characters escaped. See above.
1515 public static char[] strescape(char[] source
, char[] exceptions
)
1517 // gchar* g_strescape (const gchar *source, const gchar *exceptions);
1518 return Str
.toString(g_strescape(Str
.toStringz(source
), Str
.toStringz(exceptions
)) );
1522 * Replaces all escaped characters with their one byte equivalent. It
1523 * does the reverse conversion of g_strescape().
1525 * a string to compress.
1527 * a newly-allocated copy of source with all escaped
1528 * character compressed.
1530 public static char[] strcompress(char[] source
)
1532 // gchar* g_strcompress (const gchar *source);
1533 return Str
.toString(g_strcompress(Str
.toStringz(source
)) );
1537 * For each character in string, if the character is not in valid_chars,
1538 * replaces the character with substitutor. Modifies string in place,
1539 * and return string itself, not a copy. The return value is to allow
1540 * nesting such as g_ascii_strup (g_strcanon (str, "abc", '?')).
1542 * a nul-terminated array of bytes.
1544 * bytes permitted in string.
1546 * replacement character for disallowed bytes.
1550 public static char[] strcanon(char[] string
, char[] validChars
, char substitutor
)
1552 // gchar* g_strcanon (gchar *string, const gchar *valid_chars, gchar substitutor);
1553 return Str
.toString(g_strcanon(Str
.toStringz(string
), Str
.toStringz(validChars
), substitutor
) );
1557 * Splits a string into a maximum of max_tokens pieces, using the given
1558 * delimiter. If max_tokens is reached, the remainder of string is appended
1559 * to the last token.
1560 * As a special case, the result of splitting the empty string "" is an empty
1561 * vector, not a vector containing a single string. The reason for this
1562 * special case is that being able to represent a empty vector is typically
1563 * more useful than consistent handling of empty elements. If you do need
1564 * to represent empty elements, you'll need to check for the empty string
1565 * before calling g_strsplit().
1567 * a string to split.
1569 * a string which specifies the places at which to split the string.
1570 * The delimiter is not included in any of the resulting strings, unless
1571 * max_tokens is reached.
1573 * the maximum number of pieces to split string into. If this is
1574 * less than 1, the string is split completely.
1576 * a newly-allocated NULL-terminated array of strings. Use
1577 * g_strfreev() to free it.
1579 public static char** strsplit(char[] string
, char[] delimiter
, int maxTokens
)
1581 // gchar** g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens);
1582 return g_strsplit(Str
.toStringz(string
), Str
.toStringz(delimiter
), maxTokens
);
1586 * Splits string into a number of tokens not containing any of the characters
1587 * in delimiter. A token is the (possibly empty) longest string that does not
1588 * contain any of the characters in delimiters. If max_tokens is reached, the
1589 * remainder is appended to the last token.
1590 * For example the result of g_strsplit_set ("abc:def/ghi", ":/", -1) is a
1591 * NULL-terminated vector containing the three strings "abc", "def",
1593 * The result if g_strsplit_set (":def/ghi:", ":/", -1) is a NULL-terminated
1594 * vector containing the four strings "", "def", "ghi", and "".
1595 * As a special case, the result of splitting the empty string "" is an empty
1596 * vector, not a vector containing a single string. The reason for this
1597 * special case is that being able to represent a empty vector is typically
1598 * more useful than consistent handling of empty elements. If you do need
1599 * to represent empty elements, you'll need to check for the empty string
1600 * before calling g_strsplit_set().
1601 * Note that this function works on bytes not characters, so it can't be used
1602 * to delimit UTF-8 strings for anything but ASCII characters.
1604 * The string to be tokenized
1606 * A nul-terminated string containing bytes that are used
1607 * to split the string.
1609 * The maximum number of tokens to split string into.
1610 * If this is less than 1, the string is split completely
1612 * a newly-allocated NULL-terminated array of strings. Use
1613 * g_strfreev() to free it.
1616 public static char** strsplitSet(char[] string
, char[] delimiters
, int maxTokens
)
1618 // gchar** g_strsplit_set (const gchar *string, const gchar *delimiters, gint max_tokens);
1619 return g_strsplit_set(Str
.toStringz(string
), Str
.toStringz(delimiters
), maxTokens
);
1623 * Frees a NULL-terminated array of strings, and the array itself.
1624 * If called on a NULL value, g_strfreev() simply returns.
1626 * a NULL-terminated array of strings to free.
1628 public static void strfreev(char** strArray
)
1630 // void g_strfreev (gchar **str_array);
1631 g_strfreev(strArray
);
1635 * Concatenates all of the given strings into one long string. The returned string
1636 * should be freed when no longer needed.
1638 * The variable argument list must end with NULL.
1639 * If you forget the NULL, g_strconcat() will start appending
1640 * random memory junk to your string.
1642 * The first string to add, which must not be NULL.
1644 * a NULL-terminated list of strings to append to the string.
1646 * a newly-allocated string containing all the string arguments.
1648 public static char[] strconcat(char[] string1
, ... )
1650 // gchar* g_strconcat (const gchar *string1, ...);
1651 return Str
.toString(g_strconcat(Str
.toStringz(string1
)) );
1655 * Joins a number of strings together to form one long string, with the optional
1656 * separator inserted between each of them.
1658 * a string to insert between each of the strings, or NULL.
1660 * a NULL-terminated list of strings to join.
1662 * a newly-allocated string containing all of the strings joined
1663 * together, with separator between them.
1665 public static char[] strjoin(char[] separator
, ... )
1667 // gchar* g_strjoin (const gchar *separator, ...);
1668 return Str
.toString(g_strjoin(Str
.toStringz(separator
)) );
1672 * Joins a number of strings together to form one long string, with the optional
1673 * separator inserted between each of them.
1675 * a string to insert between each of the strings, or NULL.
1677 * a NULL-terminated array of strings to join.
1679 * a newly-allocated string containing all of the strings joined
1680 * together, with separator between them.
1682 public static char[] strjoinv(char[] separator
, char** strArray
)
1684 // gchar* g_strjoinv (const gchar *separator, gchar **str_array);
1685 return Str
.toString(g_strjoinv(Str
.toStringz(separator
), strArray
) );
1689 * Returns the length of the given NULL-terminated
1690 * string array str_array.
1692 * a NULL-terminated array of strings.
1694 * length of str_array.
1697 public static uint strvLength(char** strArray
)
1699 // guint g_strv_length (gchar **str_array);
1700 return g_strv_length(strArray
);
1704 * Returns a string corresponding to the given error code, e.g. "no such process".
1705 * This function is included since not all platforms support the
1706 * strerror() function.
1708 * the system error number. See the standard C errno
1711 * a string describing the error code.
1712 * If the error code is unknown, it returns "unknown error (<code>)".
1713 * The string can only be used until the next call to g_strerror().
1715 public static char[] strerror(int errnum
)
1717 // const gchar* g_strerror (gint errnum);
1718 return Str
.toString(g_strerror(errnum
) );
1722 * Returns a string describing the given signal, e.g. "Segmentation fault".
1723 * This function is included since not all platforms support the
1724 * strsignal() function.
1726 * the signal number. See the signal
1729 * a string describing the signal.
1730 * If the signal is unknown, it returns "unknown signal (<signum>)".
1731 * The string can only be used until the next call to g_strsignal().
1733 public static char[] strsignal(int signum
)
1735 // const gchar* g_strsignal (gint signum);
1736 return Str
.toString(g_strsignal(signum
) );