Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- RLIB 3.0a Reference - <b>function:</b> anycharsin() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function:    ANYCHARSIN()

Purpose:     Test if any characters in one string are found in another

Syntax:      ANYCHARSIN( characters, string )

Arguments:   characters  - Characters to test for existence in the string.
                           May be any combination of one or more
                           characters.

             string      - The character string to test if any of the
                           characters in the <characters> parameter exist.

Returns:     Zero if none of the characters in <characters> are found in
             <string>, otherwise returns the position in <characters> of the
             1st character found in <string>.

Description: ANYCHARSIN() is used to test if any characters in one string
             are contained in a second string.  If a character is found,
             its position in <string> is returned.  This is useful to
             validate that only valid characters are contained in strings
             such as filenames.

Notes:       If an invalid parameter or an invalid number of parameters
             are passed, a zero will be returned and RLIBERROR() set.

Example:     fname = SPACE(66)
             @ 1,0 SAY "Enter filename:" GET fname VALID GoodFname(fname)
             READ
             RETURN


             *-----------------------------------------------------------
             FUNCTION GoodFname
             PARAMETER filename
             PRIVATE badchars, position
             badchars = ' "/[]:*<>|+=;,?'
             position = AnyCharsIn( badchars, filename )
             IF position > 0
                BUZZ()
                BOXASK( 'W+/R', 'The "' + SUBSTR(badchars,position,1) +;
                        '" character is not allowed in filenames!',;
                        'Press any key to continue', 10 )
             ENDIF
             RETURN (position = 0)

Source:      RL_ANYCH.PRG

See also:    BOXASK()

See Also: BOXASK()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson