Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-825] case insensitive search broken (using JS search function)

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:54:21.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.3.0
ComponentsiOS
Labelsn/a
ReporterNolan Wright
AssigneeBlain Hamon
Created2011-04-15T02:37:15.000+0000
Updated2011-04-17T01:54:21.000+0000

Description

var mystring = "Add to Address Book";

// with /i modifier Ti.API.info(mystring.search(/s/i)); // -1 (incorrect) (string length: odd)
Ti.API.info(mystring.search(/ss/i)); // 12 (correct) (string length: even)
Ti.API.info(mystring.search(/ess/i)); // -1 (incorrect) (string length: odd)
Ti.API.info(mystring.search(/ress/i)); // 10 (correct) (string length: even)
Ti.API.info(mystring.search(/dress/i)); // -1 (incorrect) (string length: odd)
Ti.API.info(mystring.search(/ddress/i)); // 8 (correct) (string length: even)
Ti.API.info(mystring.search(/address/i)); // -1 (incorrect) (string length: odd)
Ti.API.info(mystring.search(/address /i)); // 7 (correct) (string length: even)

// no modifier Ti.API.info(mystring.search(/address/)); // -1 (correct) (both cases correct here)
Ti.API.info(mystring.search(/ddress/)); // 8 (correct)

in this code, any odd numbered search string fails. removing the /i (case insensitive) causes them all to work

Comments

  1. Stephen Tramer 2011-04-15

    Fixed in a submit to tijscore (8ebc51c51514775784f41f1a666919a42912a692).

JSON Source