Search This Blog

Saturday 17 March 2012

String operations as sorting,splitting and sorting in Android and Java

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){
            TextUtils.SimpleStringSplitter spliter=new SimpleStringSplitter(delimiter);
            Vector<String> result=new  Vector<String>();
            for(String temp : spliter ){
            return result;
Removing special characters from string    

       * @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){
            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;
            param1=(Vector<String>) paramList;
            return param1;


  1. kindly tell me how to send a string from one emulator to another using wi-fi

    1. Hi 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


Feedback always help in improvement. If you have any query suggestion feel free to comment and Keep visiting my blog to encourage me to blogging

Android News and source code