1

次のような JavaScript の stripos 関数を使用します。

function stripos (f_haystack, f_needle, f_offset) {
  var haystack = (f_haystack + '').toLowerCase();
  var needle = (f_needle + '').toLowerCase();
  var index = 0;

  if ((index = haystack.indexOf(needle, f_offset)) !== -1) {
    return index;
  }
  return false;
}

特殊文字と一致するように、この関数をどのように使用/再コーディングしますか?

かのように:

var haystack = 'Le créme';
var needle   = 'reme';
// ^ these two should match (anything other than false)
4

1 に答える 1