package com.sabirjan.CaoZuoTXT;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import android.content.Context;

public class ChaXun_Rayon {
	
	public String GetNumber(Context context,String name)
	{
		String str="";
		String fileName="mobile/000.txt";

	// 存储内容的文本对象
	StringBuilder text = new StringBuilder();

	try {
		BufferedReader bufRead = new BufferedReader(new InputStreamReader(context.getResources().getAssets().open(fileName),"utf-8"));  
		
	    String line;

	    while ((line = bufRead.readLine()) != null) 
	    {
	    	str=line.substring(0,line.indexOf(';'));
	    	str=str.replace(";", "");
	       if(str.equals(name))
	       {
	    	   return line.replace(";","\n");
	       }
	    }
			
			
		}
		catch(Exception ex)
		{
			
		}
		return "";
	}
	public String GetName(Context context,String number)
	{
		String str="";
		String fileName="mobile/000.txt";

	// 存储内容的文本对象
	StringBuilder text = new StringBuilder();

	try {
		BufferedReader bufRead = new BufferedReader(new InputStreamReader(context.getResources().getAssets().open(fileName),"utf-8"));  
		
	    String line;

	    while ((line = bufRead.readLine()) != null) 
	    {
	    	str=line.substring(line.indexOf(";"));
	       if(str.contains(number))
	       {
	    	   
	    	   return line.replace(";","\n");
	       }
	    }
			
			
		}
		catch(Exception ex)
		{
			
		}
		return "";
	}
}
