String.prototype.equals(text, ignoreCase, trim)

Description:

Compare a string and indicate whether they are the same.

Parameters:

  • text: the string text to be compared.
    • Type: String
  • ignoreCase: A flag indicating whether ignoring the case when do the comparison.
    • Type: Boolean
  • trim: A flag indicating whether trim the string before the comparison.
    • Type: Boolean

Returned Value:

  • Value calculated

Sample:

var text = "Rynn Wang";
document.write(text.equals("rynn wang"));
//Result: false;
document.write(text.equals("rynn wang", true));
//Result: true;
document.write(text.equals(" rynn wang", true));
//Result: false;
document.write(text.equals(" rynn wang", true, true));
//Result: true;

Last edited Aug 20, 2012 at 9:07 AM by rynnwang, version 3

Comments

No comments yet.