[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+---------+################################################################
#+-| STUFF() |----------------------------------------------------+###########
#| +---------+ Inserts, deletes and/or replaces length characters |###########
#+----------------------------------------------------------------+###########
##############################################################################
##############################################################################
#+--| Summary |----------------+##############################################
#| #INCLUDE string.hdr |##############################################
#+-----------------------------+##############################################
##############################################################################
##############################################################################
#+--| Syntax |-------------------------------------+##########################
#| FUNCTION CHAR stuff PROTOTYPE |##########################
#| PARAMETERS CONST CHAR source_string, ; |##########################
#| VALUE UINT start, ; |##########################
#| VALUE UINT replace_length, ; |##########################
#| CONST CHAR replace_string |##########################
#+-------------------------------------------------+##########################
##############################################################################
##############################################################################
#########+---| Description |-----------------------------------------+########
#########| The stuff() function inserts, deletes and/or replaces |########
#########| length characters from replace_string into source_string |########
#########| starting at start. replace_length characters are removed |########
#########| from source_string starting at start prior to the |########
#########| insertion. |########
#########| --------------------------------------------------------- |########
#########| If replace_length is 0, then no characters are removed |########
#########| from source_string and the insertion starts at start. If |########
#########| the length of replace_string is 0, then characters are |########
#########| removed from source_string. |########
#########+-----------------------------------------------------------+########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| |#########
#########| ? stuff( "source",0,1,"THIS" ) |#########
#########| ? stuff( "source",1,4,"THIS" ) |#########
#########| ? stuff( "source",0,0,"THIS" ) |#########
#########| ? stuff( "source",6,4,"THIS" ) |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * To see how stuff() manipulates strings, |#########
#########| * encode the following: |#########
#########| |#########
#########| #include strings.hdr |#########
#########| |#########
#########| VARDEF |#########
#########| INT start, rlen |#########
#########| CHAR src = "A source string" |#########
#########| CHAR rpl_str = "REPLACE" |#########
#########| ENDDEF |#########
#########| |#########
#########| PROCEDURE force_main |#########
#########| FOR start = 0 TO len( src ) |#########
#########| FOR rlen = 0 TO len( rpl_str ) |#########
#########| ? stuff( src, start, rlen, rpl_str ) |#########
#########| NEXT |#########
#########| NEXT |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 3 |-------------------------------------------+#########
#########| * Stuff a path into a filename |#########
#########| |#########
#########| in_file = stuff( "d:text.txt", ; |#########
#########| 2,len(getenv("TXT"),getenv("TXT")) |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
space()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson