搜索方法帮助 [英] search method help

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

问题描述

希望有人可以帮我解决这个问题。


我正在设计一个代码,这个代码是一个包含人们详细信息的基本数据库,我需要实现一个按txt搜索的方法他们姓氏的记录。

hi there hoping someone can help me out with this.

im designing a code that is a basic database holding peoples details and i need to implement a method that searches by txt for a record by their last name.

展开 | 选择 | Wrap | 行号

推荐答案


希望有人可以帮我解决这个问题。


我正在设计一个代码,这个代码是一个包含人们详细信息的基本数据库,我需要实现一个搜索方法通过txt用他们的姓氏记录。

hi there hoping someone can help me out with this.

im designing a code that is a basic database holding peoples details and i need to implement a method that searches by txt for a record by their last name.

展开 | 选择 | Wrap | 行号


嗨感谢回复,但我看不出那是怎么回事帮助我,我需要知道如何编写一个搜索方法,开始从用户获取文本,然后查看lastName数组,看看哪些记录中包含文本。

hi there thanks for replying but i cant see how that helps me, i need to know how to code a search method that will start with getting text from the user and then look in to the lastName array and see which records have the text in it.


static int find(int [] A,int N){

//在数组A中搜索整数N.


for(int index = 0;指数<则为a.length;如果(A [index] == N)

返回索引; //在这个索引中找到了N!

}
static int find(int[] A, int N) {
// Searches the array A for the integer N.

for (int index = 0; index < A.length; index++)
{
if ( A[index] == N )
return index; // N has been found at this index!
}



类似于我想的东西,但适用于我的代码,我工作什么去哪里

something similar to these i think but applying to my code, i cnt work out what goes where



嗨那里感谢回复,但我不知道这对我有什么帮助,我需要知道如何编码搜索方法将从获取用户的文本开始,然后查看lastName数组并查看哪些记录中包含文本。



类似的东西对于这些我认为但是应用到我的代码,我知道什么去了
hi there thanks for replying but i cant see how that helps me, i need to know how to code a search method that will start with getting text from the user and then look in to the lastName array and see which records have the text in it.



something similar to these i think but applying to my code, i cnt work out what goes where



只需使用一个循环并将数组中的每个元素与输入的文本进行比较。 br />
BTW如果您不愿意在程序中考虑对象,为什么要使用Java?

Just use a loop and compare each element in the array with the entered text.
BTW Why are you using Java if you''re not willing to think objects in your program?


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

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