Framework EDI Reference. Methods and Properties
mailBody. ReplaceCharNotInStr

Replace a character in the content of the body with a string.

Syntax:

Parameters:

Returns:

Returns 1 if the operation is successful; otherwise returns 0 if the operation fails.

Remarks:

Example 1.  Replace any single occurrence of the character "A" and "B" with "XYZ", but do not replace any of occurrence of the substring "ABC".  Assume the content of the body is "WHAT ABOUT ABCOULOMB?".  The method call would be:

object.ReplaceCharNotInStr("AB", "ABC", "XYZ")

The resulting body will be modified to (bold is for emphasis only):

WHXYZT XYZXYZOUT ABCOULOMXYZ?

 

Example 2.  Replace any single occurrence of the character "A" and "B" with "XYZ".  Assume the content of the file is "WHAT ABOUT ABCOULOMB?".  The method call would be:

object.ReplaceCharNotInStr("AB", "", "XYZ")

The resulting body will be modified to (bold is for emphasis only):

WHXYZT XYZXYZOUT XYZXYZXYZOULOMXYZ?

This method is useful for canonicalizing the message body.  One of the process to canonicalize text is to replace any single occurrences of carriage-return (CR) or line-feed (LF) characters with the carriage-return line-feed (CRLF) pair to indicate the end of line.  The single CR and LF do not include those already in the CRLF sequence.

object.ReplaceCharNotInStr(vbCrLf, vbCrLf, vbCrLf)

The example Visual Basic statement above is explained as follows.  (The VB constant vbCrLf is the CRLF sequence.)