简体   繁体   English

如何比较2字符串消息之间的映射单词

[英]how to compare for map a word between 2 string message

  • I have simple two message(string) and I want to compare 2 words "coffee" , "tea" ,if in the first message have the word "coffee" and second message must to have "tea" on that. 我有两个简单的message(string),我想比较2个单词“ coffee”,“ tea”,如果第一个消息中的单词为“ coffee”,第二个消息中的单词必须为“ tea”。 ** If it be this and all other word same, it true. **如果这和其他所有单词都相同,则为true。 ** can show if in these 2 word have difference on that point ** if other word in message difference it false **可以显示这两个词在该点上是否有差异**如果消息中的其他词有差异,则为假

  • how to check if the total the word define equal 如何检查单词定义的总和是否相等

  • how to loop checking one by one 如何循环一一检查

var message 1 = "He like to drink a coffee very much, he always drink a coffee in the moring and in the afternoon for some they he drink coffee more one cup. If he have to work over time he have to drink a coffee again. In a month he drank coffee a lot cup."; var message 1 =“他非常喜欢喝咖啡,他总是在早上喝咖啡,下午一些时候,他会多喝一杯咖啡。如果他必须随着时间的推移工作,就必须再次喝咖啡。一个月内,他喝了很多杯咖啡。”

var message 2 = "He like to drink a tea very much, he always drink a tea in the moring and in the afternoon for some they he drink juice more one cup. If he have to work over time he have to drink a tea again. In a month he drank tea a lot cup."; var message 2 =“他非常喜欢喝茶,他总是在早上喝茶,下午喝些茶,他会多喝一杯果汁。如果他必须随着时间的推移工作,就必须再次喝茶。一个月内他喝了很多茶。”

function compare(message_1,message_2)
{   
}

it's good if show result like this. 这样显示结果很好。

.. He like to drink a coffee very much, he always drink a coffee in the morning and in the afternoon for some they he drink !!!juice!!! ..他非常喜欢喝咖啡 ,他总是在早上和下午喝咖啡 ,因为他喝了一些果汁! more one cup. 再来一杯 If he have to work over time he have to drink a coffee again. 如果他必须超时工作,则必须再次喝咖啡 In a !!!year!!! 一年!!! he drank coffee a lot cup. 他喝了很多杯咖啡

Thank you 谢谢

 var message = prompt(""); if(message == "coffee"){ alert("He like to drink a coffee very much, he always drink a coffee in the moring and in the afternoon for some they he drink coffee more one cup. If he have to work over time he have to drink a coffee again. In a month he drank coffee a lot cup.") }else if(message == "tea"){ alert( "He like to drink a tea very much, he always drink a tea in the moring and in the afternoon for some they he drink juice more one cup. If he have to work over time he have to drink a tea again. In a month he drank tea a lot cup.") }else{ alert('choose tea or coffee') } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM