Crystal Reports for Eclipse Designer Guide

Replace

Description
Replace returns a String in which a specified substring has been replaced with another substring a specified number of times.
Overloads
  • Replace (inputString, findString, replaceString)
  • Replace (inputString, findString, replaceString, startPosition)
  • Replace (inputString, findString, replaceString, startPosition, count)
  • Replace (inputString, findString, replaceString, startPosition, count, compare)
  • Arguments
  • inputString is a String containing substring to replace.
  • findString is a substring being searched for.
  • replaceString is the replacement substring.
  • startPosition is an optional Number indicating the position within inputString where substring search is to begin. If omitted, 1 is assumed.
  • count is an optional Number of substring substitutions to perform. If omitted, the default value is –1, which means make all possible substitutions.
  • compare is an optional Number indicating the kind of comparison to use when evaluating substrings:
    • 0 performs a comparison that is case-sensitive
    • 1 performs a comparison that is case-insensitive
    If omitted, a case-sensitive comparison is performed.
  • Returns
    String value.
    Action
    Replace returns a String in which a specified substring has been replaced with another substring a specified number of times. As an option, you can also specify where in the String to begin replacing, and return a String starting from that position.
    Typical use
    To systematically replace in a String one substring with another.
    Examples
    The following examples assume that inputString is the text String "Monday is my day off. Can we meet next Monday?".
    Replace (inputString, "Monday", "Wednesday")
    Returns "Wednesday is my day off. Can we meet next Wednesday?".
    Replace (inputString, "Monday", "Wednesday", 23)
    Returns "Can we meet next Wednesday?" The replacement begins at the 23rd character from the beginning of the original inputString. The returned string is this portion of the string with the substitutions made.
    Replace (inputString, "Monday", "Wednesday", 1, 1)
    Returns "Wednesday is my day off. Can we meet next Monday?" There is only 1 replacement beginning at the 1st character from the beginning of the original inputString. The returned string is thus the original string with the single substitution made.
    Replace (inputString, "monday", "Wednesday", 1, -1, 0)
    Returns the same inputString with no replacements since no match was found for "monday" with a case-sensitive comparison.
    Replace (inputString, "monday", "Wednesday", 1, -1, 1)
    Returns the inputString with both occurrences of "Monday" replaced by "Wednesday". That is, "Wednesday is my day off. Can we meet next Wednesday?".
    Comments
    The returned value of the Replace function is a String, with the specified substring replacements made, that begins at the position specified by startPosition and ends at the end of the inputString string. It is not a copy of the original string from start to finish.



    SAP BusinessObjects
    http://www.sap.com/sapbusinessobjects/
    Support services
    http://service.sap.com/bosap-support/
    Product Documentation on the Web
    http://help.sap.com/