.concat()

This method appends one String to the end of another.

Description of the method

Description: This method appends one String to the end of another. The method returns a String with the value of the String passed in to the method appended to the end of the String used to invoke this method.
Available for: string
Parameters: string
Return type: string

Example

Context: TransactionType1
OCL: self.Debtor.Name.concat(self.Creditor.Name) = self.Id
Description: This rule takes debtor name and concatenates it with creditor name, and then verifies that Id contains the concatenated string

 

The XML snippets below would pass this check.

<Transaction>
    <Id>Debtor1Creditor1</Id>
    <Amount>1</Amount>
    <Debtor>
      <Name>Debtor1</Name>
    </Debtor>
    <Creditor>
      <Name>Creditor1</Name>
    </Creditor>
  </Transaction>

 

 

The other snippet below however would not pass this check.

<Transaction>
    <Id>aaaa</Id>
    <Amount>1</Amount>
    <Debtor>
      <Name>Debtor2</Name>
    </Debtor>
    <Creditor>
      <Name>Creditor2</Name>
    </Creditor>
  </Transaction>