[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+------+###################################################################
#+-| AT() |------------------------------------------+########################
#| +------+ Returns position of string within string |########################
#+---------------------------------------------------+########################
##############################################################################
##############################################################################
#+--| Summary |----------------+##############################################
#| #INCLUDE string.hdr |##############################################
#+-----------------------------+##############################################
##############################################################################
##############################################################################
#+--| Syntax |----------------------------------------------------------+#####
#| FUNCTION UINT at PROTOTYPE |#####
#| PARAMETERS CONST CHAR find_string, CONST CHAR source_string |#####
#+----------------------------------------------------------------------+#####
##############################################################################
##############################################################################
#######+---| Description |--------------------------------------------+#######
#######| The at() function returns the relative position of the first |#######
#######| occurrence of find_string within source_string. If no match |#######
#######| is found, a zero is returned. The first character in |#######
#######| source_string is considered to be position 1. |#######
#######+--------------------------------------------------------------+#######
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Make sure a parameter has been specified on |#########
#########| * a command line: progname /{filename}. |#########
#########| |#########
#########| PROCEDURE force_main |#########
#########| PARAMETERS CHAR(128) cmd_line |#########
#########| |#########
#########| IF at( "/", cmd_line ) = 0 |#########
#########| ? "Invalid command line" |#########
#########| QUIT |#########
#########| ENDIF |#########
#########| {...} |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Isolate the filename from the extension and |#########
#########| * append a "BAK" to the filename. |#########
#########| |#########
#########| RENAME fname TO substr( fname,1,at( ".", fname ) )+"BAK" |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 3 |-------------------------------------------+#########
#########| * Which character is closer to the start of |#########
#########| * the string? |#########
#########| |#########
#########| IF at( c[ q ], a_str ) >= at( d[ q ], a_str ) |#########
#########| RETURN c[ q ] |#########
#########| ENDIF |#########
#########| RETRUN d[ q ] |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
stuff()
substr()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson