P
Ptaku25
Hi all
// my code
var string1= "Pablo has 3 cats and 1 dog";
var string2= "Pablo has 3 cats";
var str1 = "";
var str2 = "";
str1 = string1.match(string1, "g");
str2 = string2.match(string1, "g");
if (str1 == str2) // STRING IS NOT the same :-( , what is wrong ???
{
app.alert("String are the same ");
}
else
{
app.alert("String is different...");
}
I want to compare two strings in 'if' statement, which are asssigned to
variables, If I compare two variable which have assigned the same (in
my opinion) string after RegExp match function the string is different
unfortunatellly :-(
but when I compare in 'if' statement:
if( str1 == "Pablo has 3 cats") or
if( str2 == "Pablo has 3 cats") or
if("Pablo has 3 cats" == str2) or
if("Pablo has 3 cats" == str2)
THIS COMPARISON IS WORKING WELL and strings is the same
I wonder why my string is not the same ???
the match function returned me the same string for str1 and str2
variable when I invoke alert funtion on it, but for 'if' statement the
string is not the same :-(, what is wrong ???
// my code
var string1= "Pablo has 3 cats and 1 dog";
var string2= "Pablo has 3 cats";
var str1 = "";
var str2 = "";
str1 = string1.match(string1, "g");
str2 = string2.match(string1, "g");
if (str1 == str2) // STRING IS NOT the same :-( , what is wrong ???
{
app.alert("String are the same ");
}
else
{
app.alert("String is different...");
}
I want to compare two strings in 'if' statement, which are asssigned to
variables, If I compare two variable which have assigned the same (in
my opinion) string after RegExp match function the string is different
unfortunatellly :-(
but when I compare in 'if' statement:
if( str1 == "Pablo has 3 cats") or
if( str2 == "Pablo has 3 cats") or
if("Pablo has 3 cats" == str2) or
if("Pablo has 3 cats" == str2)
THIS COMPARISON IS WORKING WELL and strings is the same
I wonder why my string is not the same ???
the match function returned me the same string for str1 and str2
variable when I invoke alert funtion on it, but for 'if' statement the
string is not the same :-(, what is wrong ???