How to compare two strings case insensitive

63 views
Skip to first unread message

karan nayyar

unread,
Jan 27, 2022, 5:38:03 AM1/27/22
to mozilla-rhino
I intend to check if a string is a substring of another string. However, case insensitive match is not possible since  toLowerCase() and toUpperCase() methods are not supported in  Rhino 1.7.13.

var stored_string="{{SSHA1}9BC34549D565D9505B287DE0CD20AC77BE1D3F2C"

var str = "9bc34549d565d9505b287de0cd20ac77be1d3f2c"

I am using indexOf mathod to check for the substring.

if (stored_string.toString().indexOf(str)===0) {
   //do something
}

Is there any good way this comparison is possible case insensitive?

P

unread,
Feb 28, 2022, 12:01:11 PM2/28/22
to mozilla-rhino

Based on what did you reach the conclusion that toUpper/LowerCase aren't supported in 1.7.13? Cause I'm pretty sure they are
Reply all
Reply to author
Forward
0 new messages