首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何比较两个字符串消息之间的单词映射

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

Stack Overflow用户
提问于 2017-09-19 09:44:03
回答 1查看 42关注 0票数 0
  • 我有两个简单的消息(字符串),我想比较两个词“咖啡”,“茶”,如果在第一个消息有“咖啡”和第二个信息必须有“茶”。**如果这个词和所有其他词相同,那就是事实。**可以显示在这两个单词中是否在这一点上有差异**如果消息中的其他单词存在差异,则为假。
  • 如何检查单词的总定义是否相等
  • 如何逐个循环检查

他很喜欢喝咖啡,每天早上喝咖啡,下午喝一杯以上的咖啡。如果工作时间长了,他就得再喝一杯咖啡。一个月后,他喝了很多咖啡。

“他非常喜欢喝茶,每天早上喝一杯茶,下午喝一杯以上的果汁。如果他要工作一段时间,他就得再喝一杯茶。一个月后,他喝了很多茶。”

代码语言:javascript
复制
function compare(message_1,message_2)
{   
}

如果是这样的表演效果就好了。

。。他非常喜欢喝咖啡,他总是在早上和下午喝咖啡给他们喝!果汁!!多一杯。如果他不得不长期工作,他必须再喝一杯咖啡。一年!他喝了很多咖啡

谢谢

EN

回答 1

Stack Overflow用户

发布于 2017-09-19 10:57:37

代码语言:javascript
复制
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')
}

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46297108

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档