18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
how to find string in another string
String1="San Diego"(got this values from gettext method)
String2="San Diego San Diego"
Ex:2
String1="CA"
String2="CA USA"
i want to find string1 is present in string2. i know i could solve this by using indexof and match. but i tried both of them, but could not get answer.Could any one, please resolve this.
var $InfoState=_getText(_cell(_table("formTable"),4,5));
var $leftNavState=_getText(_cell(_table(16),9,0));
var $result1=$InfoState.test($leftNavState);
_alert($result1);
Even i tried this also(using test regular expression). but could not get answer. But when i try the below code it's working fine. Please let me know where i am going wrong
var $str="Hello world";
var $patt=/Hello/g
var $result=$patt.test($str);
_alert($result);
String2="San Diego San Diego"
Ex:2
String1="CA"
String2="CA USA"
i want to find string1 is present in string2. i know i could solve this by using indexof and match. but i tried both of them, but could not get answer.Could any one, please resolve this.
var $InfoState=_getText(_cell(_table("formTable"),4,5));
var $leftNavState=_getText(_cell(_table(16),9,0));
var $result1=$InfoState.test($leftNavState);
_alert($result1);
Even i tried this also(using test regular expression). but could not get answer. But when i try the below code it's working fine. Please let me know where i am going wrong
var $str="Hello world";
var $patt=/Hello/g
var $result=$patt.test($str);
_alert($result);
Comments
Try with the indexOf function in javascript. Iam able to execute the following script in tableTest demo page and able to get the index of the one string in another.
This popup with the index(1) of occurance of one string in another string.
This might help you.
Regards,
Theeran.