diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-10-09 16:18:32 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-10-09 16:18:32 +0400 |
commit | 2cf7d4867d4f6651fa54c3824f5e9f8f8a3e3770 (patch) | |
tree | 988fc47eb28db68bd59eb23f4670f54fd84182fe /source/blender/blenlib/BLI_string.h | |
parent | 9f7038c5a73d8e73b858a129561d4721481f62e2 (diff) |
(Untested) String Replacement Function in blenlib
Currently this hasn't been tested yet, but committing this first before I potentially use it for fixing RNA-paths...
Diffstat (limited to 'source/blender/blenlib/BLI_string.h')
-rw-r--r-- | source/blender/blenlib/BLI_string.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index bf93dc19cc5..53563f85eb9 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -68,6 +68,18 @@ char *BLI_strdupn(const char *str, int len); */ char *BLI_strncpy(char *dst, const char *src, int maxncpy); + /** + * Returns a copy of the cstring @a str into a newly mallocN'd + * string with all instances of oldText replaced with newText, + * and returns it. + * + * @param str The string to replace occurances of oldText in + * @param oldText The text in the string to find and replace + * @param newText The text in the string to find and replace + * @retval Returns the duplicated string + */ +char *BLI_replacestr(char *str, const char *oldText, const char *newText); + /* * Replacement for snprintf */ |