The StringBuffer class / base.StringBuffer methods |
Compare strings (case sensitive).
Use the equals() method to determine whether the value of a base.StringBuffer object is identical to a specified string.
This method is case-sensitive.
Since the parameter for the method must be a string, you can use the toString() method to convert a base.StringBuffer object in order to compare it.
The method returns TRUE if the strings are identical, otherwise it returns FALSE.
DEFINE buf, buf2 base.StringBuffer, mystring STRING LET buf = base.StringBuffer.create() CALL buf.append("there") -- compare to a STRING IF buf.equals("there") THEN DISPLAY "buf matches there" END IF -- compare to a STRING variable LET mystring = "there" IF buf.equals(mystring) THEN DISPLAY "buf matches mystring" END IF -- compare to another StringBuffer object LET buf2 = base.StringBuffer.create() CALL buf2.append("there") IF buf.equals(buf2.toString()) THEN DISPLAY "buf matches buf2" END IF
Output:
buf matches there buf matches mystring buf matches buf2