Compare two equal ID values of different lengths: Compare a string to an ID of the same length. Compare a string to an object containing a number Compare a string to an object containing a string System.assert(s.endsWith('World')) equalsĮquals(stringOrld) is used when you want to compare an object that is a string or an ID, to a given string. System.assertEquals(s2, s1.deleteWhitespace()) ĭifference(secondString) returns the difference between the first and the second string.ĮndsWith(suffix) compares the given string with a specified suffix and returns true only if the string ends with the suffix. System.assertEquals(1, s.countMatches('Hey')) deleteWhitespaceĭeleteWhitespace() removes the whitespaces from the string. System.assertEquals(2, s.countMatches('Hey')) System.assertEquals(1, s.countMatches('Hey')) System.assertEquals(result, true) countMatchesĬountMatches(substring) returns the value as the number of times that the substring appears in the string that is called the method. System.assertEquals(result, -1) ContainsĬontains(substring) returns true if the string that called this method contains the characters in the same sequence as the substring specified. System.assertEquals(72, str.codePointAt(0)) ĬompareTo(secondString) compares two strings in the dictionary order based on their Unicode values. System.assertEquals(937, str.charAt(0)) codePointAtĬodePointAt returns the value of the Unicode at the given index. If the given size is smaller than the string then the string is returned as it is without the padding string.ĬharAt(index) string method returns the value of the character at the index given.įor example: String str = 'Hello Intellipaat.'
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |