+----------------------------------------------------------------------+
| FUNCTION( |
| name , => function name |
| type , => function type retrun(STRING|REAL|LONG) |
| /S;|R;|I;/ , => args->arg_type pattern (S:STRING;I:INTEGER;R:REAL) |
| arg_count , => args->arg_count min , must be > 0 |
| maybe_null , => initid->maybe_null (1|0) |
| max_length , => initid->max_length, -1 to no max |
| "USAGE: .." => String to be used as error message |
| ) |
+----------------------------------------------------------------------+
For
example
:
/****************************************************************************** ** str_replace ** use BString::extern int bfindreplace (bstring b, const_bstring find, ** const_bstring replace, int position); ** Replace all occurrences of the find substring with a replace bstring ** after a given position in the bstring b. ******************************************************************************/ // {{{ FUNCTION( str_replace, STRING, "S;S;S;I", 4, 1, 255, "USAGE: STRING str_replace(STRING str, STRING find, STRING replace, INT pos)" ) { bstring string_1 = bfromcstr ( ARGV(0) ); bstring string_2 = bfromcstr ( ARGV(1) ); bstring string_3 = bfromcstr ( ARGV(2) ); long long pos = *((long long*) ARGV(1) ); bfindreplace ( string_1, string_2, string_3, pos ); RETURN_STRING( bdata( string_1 ) ); } // }}}