CVS update: php3/functions
| From: | rasmus | Date: | Thu, 17 Dec 1998 16:22:09 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-2831@lists.php.net to get a copy of this message | ||
Date: Thursday December 17, 1998 @ 11:22
Author: rasmus
Update of /repository/php3/functions
In directory asf:/home/rasmus/php3/functions
Modified Files:
basic_functions.c php3_string.h string.c
Log Message:
Add chr_replace() function
Index: php3/functions/basic_functions.c
diff -c php3/functions/basic_functions.c:1.236 php3/functions/basic_functions.c:1.237
*** php3/functions/basic_functions.c:1.236 Mon Dec 7 10:40:40 1998
--- php3/functions/basic_functions.c Thu Dec 17 11:22:08 1998
***************
*** 173,178 ****
--- 173,179 ----
{"hebrev", php3_hebrev, NULL},
{"hebrevc", php3_hebrev_with_conversion,NULL},
{"nl2br", php3_newline_to_br, NULL},
+ {"chr_replace", php3_chr_replace, NULL},
{"basename", php3_basename, NULL},
{"dirname", php3_dirname, NULL},
{"stripslashes", php3_stripslashes, NULL},
Index: php3/functions/php3_string.h
diff -c php3/functions/php3_string.h:1.23 php3/functions/php3_string.h:1.24
*** php3/functions/php3_string.h:1.23 Mon Dec 7 10:40:44 1998
--- php3/functions/php3_string.h Thu Dec 17 11:22:08 1998
***************
*** 29,35 ****
*/
! /* $Id: php3_string.h,v 1.23 1998/12/07 15:40:44 shane Exp $ */
#ifndef _PHPSTRING_H
#define _PHPSTRING_H
--- 29,35 ----
*/
! /* $Id: php3_string.h,v 1.24 1998/12/17 16:22:08 rasmus Exp $ */
#ifndef _PHPSTRING_H
#define _PHPSTRING_H
***************
*** 74,79 ****
--- 74,80 ----
extern void php3_chr(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ord(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_newline_to_br(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_chr_replace(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_setlocale(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_stristr(INTERNAL_FUNCTION_PARAMETERS);
Index: php3/functions/string.c
diff -c php3/functions/string.c:1.148 php3/functions/string.c:1.149
*** php3/functions/string.c:1.148 Mon Dec 7 10:40:44 1998
--- php3/functions/string.c Thu Dec 17 11:22:08 1998
***************
*** 30,36 ****
*/
! /* $Id: string.c,v 1.148 1998/12/07 15:40:44 shane Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
--- 30,36 ----
*/
! /* $Id: string.c,v 1.149 1998/12/17 16:22:08 rasmus Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
***************
*** 1354,1359 ****
--- 1354,1376 ----
convert_to_string(str);
_php3_char_to_str(str->value.str.val,str->value.str.len,'\n',"<br>\n",5,return_value);
+ }
+ /* }}} */
+
+ /* {{{ proto string chr_replace(string char, string repl, string str)
+ Find all occurrences of char in str and replace with repl */
+ void php3_chr_replace(INTERNAL_FUNCTION_PARAMETERS)
+ {
+ pval *chr, *replace, *str;
+
+ if (ARG_COUNT(ht)!=3 || getParameters(ht, 3, &chr, &replace, &str)==FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_string(chr);
+ convert_to_string(str);
+
+
_php3_char_to_str(str->value.str.val,str->value.str.len,chr->value.str.val[0],replace->value.str.val,
replace->value.str.len ,return_value);
}
/* }}} */
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net