* Strips the whitespaces from the end of s.
* By default (when char_list=NULL), these characters get stripped:
*
- * - " " (ASCII 32 (0x20)) space.
- * - "\t" (ASCII 9 (0x09)) tab.
- * - "\n" (ASCII 10 (0x0A)) line feed.
- * - "\r" (ASCII 13 (0x0D)) carriage return.
- * - "\0" (ASCII 0 (0x00)) NULL.
- * - "\x0B" (ASCII 11 (0x0B)) vertical tab.
+ * - " " (ASCII 32 (0x20)) space.
+ * - "\t" (ASCII 9 (0x09)) tab.
+ * - "\n" (ASCII 10 (0x0A)) line feed.
+ * - "\r" (ASCII 13 (0x0D)) carriage return.
+ * - "\0" (ASCII 0 (0x00)) NULL.
+ * - "\x0B" (ASCII 11 (0x0B)) vertical tab.
*
* @param s The string to strip. Modified in place.
* @param char_list A string which contains the characters you want to strip.
* Strips the whitespaces from the begining of s.
* By default (when char_list=NULL), these characters get stripped:
*
- * - " " (ASCII 32 (0x20)) space.
- * - "\t" (ASCII 9 (0x09)) tab.
- * - "\n" (ASCII 10 (0x0A)) line feed.
- * - "\r" (ASCII 13 (0x0D)) carriage return.
- * - "\0" (ASCII 0 (0x00)) NULL.
- * - "\x0B" (ASCII 11 (0x0B)) vertical tab.
+ * - " " (ASCII 32 (0x20)) space.
+ * - "\t" (ASCII 9 (0x09)) tab.
+ * - "\n" (ASCII 10 (0x0A)) line feed.
+ * - "\r" (ASCII 13 (0x0D)) carriage return.
+ * - "\0" (ASCII 0 (0x00)) NULL.
+ * - "\x0B" (ASCII 11 (0x0B)) vertical tab.
*
* @param s The string to strip. Modified in place.
* @param char_list A string which contains the characters you want to strip.
* Strips the whitespaces from both the beginning and the end of s.
* By default (when char_list=NULL), these characters get stripped:
*
- * - " " (ASCII 32 (0x20)) space.
- * - "\t" (ASCII 9 (0x09)) tab.
- * - "\n" (ASCII 10 (0x0A)) line feed.
- * - "\r" (ASCII 13 (0x0D)) carriage return.
- * - "\0" (ASCII 0 (0x00)) NULL.
- * - "\x0B" (ASCII 11 (0x0B)) vertical tab.
+ * - " " (ASCII 32 (0x20)) space.
+ * - "\t" (ASCII 9 (0x09)) tab.
+ * - "\n" (ASCII 10 (0x0A)) line feed.
+ * - "\r" (ASCII 13 (0x0D)) carriage return.
+ * - "\0" (ASCII 0 (0x00)) NULL.
+ * - "\x0B" (ASCII 11 (0x0B)) vertical tab.
*
* @param s The string to strip.
* @param char_list A string which contains the characters you want to strip.
*
* By default (with sep=NULL), these characters are used as separator:
*
- * - " " (ASCII 32 (0x20)) space.
- * - "\t" (ASCII 9 (0x09)) tab.
- * - "\n" (ASCII 10 (0x0A)) line feed.
- * - "\r" (ASCII 13 (0x0D)) carriage return.
- * - "\0" (ASCII 0 (0x00)) NULL.
- * - "\x0B" (ASCII 11 (0x0B)) vertical tab.
+ * - " " (ASCII 32 (0x20)) space.
+ * - "\t" (ASCII 9 (0x09)) tab.
+ * - "\n" (ASCII 10 (0x0A)) line feed.
+ * - "\r" (ASCII 13 (0x0D)) carriage return.
+ * - "\0" (ASCII 0 (0x00)) NULL.
+ * - "\x0B" (ASCII 11 (0x0B)) vertical tab.
*/
xbt_dynar_t xbt_str_split(const char *s, const char *sep)
return res;
}
+/* @brief Retrun 1 if string 'str' starts with string 'start'
+ *
+ * \param str a string
+ * \param start the string to search in str
+ *
+ * \return 1 if 'str' starts with 'start'
+ */
+int xbt_str_start_with(const char* str, const char* start)
+{
+ int i;
+ size_t l_str = strlen(str);
+ size_t l_start = strlen(start);
+
+ if(l_start > l_str) return 0;
+
+ for(i = 0; i< l_start; i++){
+ if(str[i] != start[i]) return 0;
+ }
+
+ return 1;
+}
+
#ifdef SIMGRID_TEST
#include "xbt/str.h"