搜索字符串 [英] Search Strings

查看:75
本文介绍了搜索字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在字符串中搜索项目的描述,并希望程序以任何顺序搜索匹配的单词,但它们应该相关,例如考虑这个描述:CEMENT AFRISAM 50KG SATCHETS ....

i希望用户可以输入单词SATCHETS CEMENT,搜索代码应该能够列出所有有SATCHETS的描述AND CEMENT在一行中。

How can i search within a string say a description of items and would like the program to search for matching words in any order but they should relate e.g. consider this description: CEMENT AFRISAM 50KG SATCHETS....
i would want a user to lets say type in the words "SATCHETS CEMENT", the search code should be able to list all descriptions that have SATCHETS AND CEMENT in one line.

推荐答案

循环中的循环检查所有可疑单词,反对您要搜索的所有字符串。使用String.Contains方法。

http://msdn.microsoft.com/en-us/libr....contains.aspx
Loops within loops checking all the suspect words against all the strings you want to search. Making use of the String.Contains method.

http://msdn.microsoft.com/en-us/libr....contains.aspx


即时通讯尝试但不是好吧,我可能会遗漏一些你有示例代码吗?
i m trying that but its not coming alright, i might be missing something do you have a sample code?


也许你首先告诉我们你尝试了什么(代码)并告诉我们你面临的问题用你的代码。所以我可以帮你找到东西你错过了。
Maybe you first show us what you''ve tried (code) and tell us the problem you''re facing with your code. So I could help you finding the "something" you''re missing.


这篇关于搜索字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆