Collection are very strong tool in android(as well as java).You can sort Array in ASC and DSC order very easily. I take here Mostly Hash Map and Vector
Splitting String by deli-meter and return Vector of string
/**
* @param str
* @param delimiter -char to which you want to spilt
* @return Vector of String after splitting
*/
public Vector<String> SpiltString(String str,char delimiter){
str=str.trim();
TextUtils.SimpleStringSplitter spliter=new SimpleStringSplitter(delimiter);
spliter.setString(str);
Vector<String> result=new Vector<String>();
for(String temp : spliter ){
result.add(temp);
}
return result;
}
* @param str
* @param delimiter -char to which you want to spilt
* @return Vector of String after splitting
*/
public Vector<String> SpiltString(String str,char delimiter){
str=str.trim();
TextUtils.SimpleStringSplitter spliter=new SimpleStringSplitter(delimiter);
spliter.setString(str);
Vector<String> result=new Vector<String>();
for(String temp : spliter ){
result.add(temp);
}
return result;
}
* @param str
* @return free string from speciol character
*/
public String Remove_Speciol_Character(String str){
String temp=null;
temp = str.replaceAll("[^a-zA-Z]+","");
return temp;
}
/**
* @author Ahmad
* @param Two vectore to concate
* @return combination of two vector
*/
public Vector<String> conCateTwoStringVec( Vector<String> vect1,Vector<String> vect2){
vect1.addAll(vect2);
return vect1;
}
Sorting String into DSC or ASC order
/**
* @author Ahmad
* @param Vector String to sort
* @param order in which false for asc true for desc
*/
public Vector<String> SortStringOfVector(Vector<String> param1,boolean order){
List<String> paramList=param1;
Collections.sort(paramList);
if(order)
Collections.reverse(paramList);
param1=(Vector<String>) paramList;
return param1;
}
* @return free string from speciol character
*/
public String Remove_Speciol_Character(String str){
String temp=null;
temp = str.replaceAll("[^a-zA-Z]+","");
return temp;
}
/**
* @author Ahmad
* @param Two vectore to concate
* @return combination of two vector
*/
public Vector<String> conCateTwoStringVec( Vector<String> vect1,Vector<String> vect2){
vect1.addAll(vect2);
return vect1;
}
Sorting String into DSC or ASC order
/**
* @author Ahmad
* @param Vector String to sort
* @param order in which false for asc true for desc
*/
public Vector<String> SortStringOfVector(Vector<String> param1,boolean order){
List<String> paramList=param1;
Collections.sort(paramList);
if(order)
Collections.reverse(paramList);
param1=(Vector<String>) paramList;
return param1;
}
kindly tell me how to send a string from one emulator to another using wi-fi
ReplyDeleteHi Narmeen, This is completely unrelated to above post. Try Bluetooth article given on android developer official site. And Please post related comment or if you have any un related issue, Contact me on my Google Plus profile
Delete