Code:
- //=======================================================================
- // ___ _ ___ _ _____ _ _
- // / __| |_ _ _ / __|___ _ _| |_ ___ _ |_ _| |_ (_)___
- // | (__| ' \| '_| (__/ -_) ' \ _/ -_) '_|| | | ' \| (_-<
- // \___|_||_|_| \___\___|_||_\__\___|_| |_| |_||_|_/__/
- //
- //Center text into a field given it's length and contents.
- //
- // Example:
- // myString = ChrCenterThis(myString);
- //=======================================================================
- DChrCenterThis PR 32740A Varying
- D InputStr 32740A Const Varying
-
-
- //=======================================================================
- // ___ _ ___ _ ___ _ _
- // / __| |_ _ _ / __|___| |_| __|_ __ __ _(_) |
- // | (__| ' \| '_| (_ / -_) _| _|| ' \/ _` | | |
- // \___|_||_|_| \___\___|\__|___|_|_|_\__,_|_|_|
- //
- //Get email address for any purpose.
- //
- // Examples:
- // myEmail = ChrGetEmail;
- // myEmail = ChrGetEmail(myPgm);
- // myEmail = ChrGetEmail(myPgm:myTitle:'Please Enter Email');
- // myEmail = ChrGetEmail(myPgm:myTitle:myMsg1:myMsg2:myError);
- //=======================================================================
- DChrGetEmail PR 100A Varying
- D PgmName 10A Const Options(*NoPass)
- D Title 40A Const Options(*NoPass)
- D Msg1 66A Const Options(*NoPass)
- D Msg2 66A Const Options(*NoPass)
- D Error 65A Const Options(*NoPass)
-
-
- //=======================================================================
- // ___ _ ___ _ ___ _
- // / __| |_ _ _ / __|___| |_| __|_ _| |_
- // | (__| ' \| '_| (_ / -_) _| _|\ \ / _|
- // \___|_||_|_| \___\___|\__|___/_\_\\__|
- //
- //Get extension of a file given it's complete name.
- //
- // Example:
- // MyExt = ChrGetExt(myString);
- //=======================================================================
- DChrGetExt PR 32740A Varying
- D InputStr 32740A Const Varying
-
-
- //=======================================================================
- // ___ _ ___ _ _
- // / __| |_ _ _ / __|___| |_| | _____ __ _____ _ _
- // | (__| ' \| '_| (_ / -_) _| |__/ _ \ V V / -_) '_|
- // \___|_||_|_| \___\___|\__|____\___/\_/\_/\___|_|
- //
- //Convert Input to Lower Case.
- //
- // Example:
- // myString = ChrGetLower(myString);
- //=======================================================================
- DChrGetLower PR 32740A Varying
- D InputStr 32740A Const Varying
-
-
- //=======================================================================
- // ___ _ ___ _ _ _
- // / __| |_ _ _ / __|___| |_| | | |_ __ _ __ ___ _ _
- // | (__| ' \| '_| (_ / -_) _| |_| | '_ \ '_ \/ -_) '_|
- // \___|_||_|_| \___\___|\__|\___/| .__/ .__/\___|_|
- // |_| |_|
- //Convert Input to Upper Case.
- //
- // Example:
- // myString = ChrGetUpper(myString);
- //=======================================================================
- DChrGetUpper PR 32740A Varying
- D InputStr 32740A Const Varying
-
-
- //=======================================================================
- // ___ _ ___ ___ ___
- // / __| |_ _ |_ _|_ _| __|
- // | (__| ' \| '_| | | || _|
- // \___|_||_|_||___|___|_|
- //
- //Allow for single line comparisons, fill field depending on result.
- //
- // Layout:
- // CharField = ChrIIF(Condition : IfTrue : IfFalse)
- // Examples:
- // ErrorYN = ChrIIF(myNumber >= 1 : 'Y' : 'N')
- // Output = ChrIIF(myString = *blanks : 'Generic' : Input)
- //
- // Note:
- // This function only allows char result field. RPGLE has similar
- // ability for indicators already built in.
- //
- // Layout:
- // *indicator = (Condition)
- // Example:
- // *in25 = (Error >= 1);
- // (If Condition is true, indicator = *On, otherwise = *Off)
- //=======================================================================
- DChrIIF PR 32740A Varying
- D Condition N Value
- D True 32740A Varying Value
- D False 32740A Varying Value
-
-
- //=======================================================================
- // ___ _ ___
- // / __| |_ _ |_ _|_ _
- // | (__| ' \| '_| || ' \
- // \___|_||_|_||___|_||_|
- //
- //Allow for Single Line "=" Comparison, True if Input IN Any Matches (Up
- // to 20 Matches)
- //
- // Layout:
- // If ChrIn(myString:myMatch1:myMatch2:myMatch3:etc...);
- // //Do Something
- // EndIf;
- //
- // Example:
- // If ChrIn(myString:'String':'Yarn':'Thread':otherString);
- //
- // EndIf;
- //=======================================================================
- DChrIn PR N
- D Input 32740A Const Varying
- D Match1 32740A Const Varying
- D Match2 32740A Const Varying
- D Match3 32740A Const Varying Options(*NoPass)
- D Match4 32740A Const Varying Options(*NoPass)
- D Match5 32740A Const Varying Options(*NoPass)
- D Match6 32740A Const Varying Options(*NoPass)
- D Match7 32740A Const Varying Options(*NoPass)
- D Match8 32740A Const Varying Options(*NoPass)
- D Match9 32740A Const Varying Options(*NoPass)
- D Match10 32740A Const Varying Options(*NoPass)
- D Match11 32740A Const Varying Options(*NoPass)
- D Match12 32740A Const Varying Options(*NoPass)
- D Match13 32740A Const Varying Options(*NoPass)
- D Match14 32740A Const Varying Options(*NoPass)
- D Match15 32740A Const Varying Options(*NoPass)
- D Match16 32740A Const Varying Options(*NoPass)
- D Match17 32740A Const Varying Options(*NoPass)
- D Match18 32740A Const Varying Options(*NoPass)
- D Match19 32740A Const Varying Options(*NoPass)
- D Match20 32740A Const Varying Options(*NoPass)
-
-
- //=======================================================================
- // ___ _ ___ _____ _ _ _
- // / __| |_ _ _| _ \_ _(_)__| |__ / |
- // | (__| ' \| '_| / | | | / _| / / | |
- // \___|_||_|_| |_|_\ |_| |_\__|_\_\ |_|
- //
- //Replace apostrophe (') with grave accent (`) for SQL and CL commands
- // (Usually used for reports) 1 to 1 replacement, so no characters will
- // be lost in the conversion. NOT usable when wanting to search by
- // field that includes an apostrophe (i.e. A filter that searches by
- // name based on an input that includes apostrophes). To perform that
- // type of replacement, see ChrRTick2 (and note it's limitations).
- //
- // Example:
- // myString = ChrRTick1(myString);
- //=======================================================================
- DChrRTick1 PR 32740A Varying
- D InputStr 32740A Const Varying
-
-
- //=======================================================================
- // ___ _ ___ _____ _ _ ___
- // / __| |_ _ _| _ \_ _(_)__| |__ |_ )
- // | (__| ' \| '_| / | | | / _| / / / /
- // \___|_||_|_| |_|_\ |_| |_\__|_\_\ /___|
- //
- //Replace apostrophe (') with 2 apostrophes ('') for SQL and CL commands
- // (Usually used for searches based on field that includes apostrophes)
- // 1 to 2 replacement, so a field with all positions filled will start
- // to drop off the last characters during the conversion (more will drop
- // depending on the number of apostrophes in the string being searched).
- // NOT useful for reports, due to the varying length of the field.
- //
- // Example:
- // myString = ChrRTick2(myString);
- //=======================================================================
- DChrRTick2 PR 32740A Varying
- D InputStr 32740A Const Varying
-
-
- //=======================================================================
- // ___ _ ___ ___ _
- // / __| |_ _ _/ __| __ __ _ _ _ | _ \_ __| |
- // | (__| ' \| '_\__ \/ _/ _` | ' \| / '_ \ |
- // \___|_||_|_| |___/\__\__,_|_||_|_|_\ .__/_|
- // |_|
- //Our version of %scanrpl - Scan for original character(s) and replace
- // with replacement character(s). The original and replacement strings
- // ARE case sensitive.
- //
- // Examples:
- // myString = ChrScanRpl(myString:'*':' ');
- // myString = ChrScanRpl(myString:'1':'One');
- // myString = ChrScanRpl(myString:'One':'1');
- //=======================================================================
- DChrScanRpl PR 32740A Varying
- D InputStr 32740A Const Varying
- D Orig 32740A Const Varying
- D Rpl 32740A Const Varying
-
-
- //=======================================================================
- // ___ _ __ __ _ ___ _ _
- // / __| |_ _ \ \ / /_ _| | __|_ __ __ _(_) |
- // | (__| ' \| '_\ V / _` | | _|| ' \/ _` | | |
- // \___|_||_|_| \_/\__,_|_|___|_|_|_\__,_|_|_|
- //
- //Determine if email address is valid - 'Y' = Valid, 'N' = Not Valid.
- //
- // *** RETURN **********************************************************
- // *On or *Off (True or False)
- // *********************************************************************
- //
- // Examples:
- // If ChrValEmail(myEmail);
- // ExSr @SendEmail;
- // Else;
- // myError = 'Sorry, that is an invalid email address';
- // Iter;
- // EndIf;
- //
- // -Could also check if NOT true-
- // If Not ChrValEmail(myEmail);
- // myError = 'Sorry, that is an invalid email address';
- // Iter;
- // EndIf;
- //=======================================================================
- DChrValEmail PR N
- D Email 100A Const Varying
|
|