Utilutil

download Utilutil

of 2

description

util

Transcript of Utilutil

/* * Created on Apr 25, 2006 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */package com.mazdausa.rds.common.util;import java.util.ArrayList;import org.apache.log4j.Logger;import com.mazdausa.dealersystem.dealerdevelopment.wcfp.config.Config;import com.mazdausa.rds.common.email.EMazdamail;import com.mazdausa.rds.common.log.RDSLogger;/** * @author Ajijumon * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */public class Util { static Logger log = new RDSLogger().getLogger(EMazdamail.class.getName());public static String[] parseString(String actual , String delimiter){java.util.StringTokenizer token = null;String strArray[] = null;ArrayList tempCollection = null;String temp ="";if(delimiter == null || delimiter.trim().length() == 0){strArray = new String[] {actual};}else{ if(actual == null ){strArray = null;}else{token = new java.util.StringTokenizer(actual,delimiter);tempCollection = new ArrayList(); while(token.hasMoreTokens()) { temp = token.nextToken(); if(temp != null && temp.trim().length()>0){ tempCollection.add(temp); } } strArray = (String[])tempCollection.toArray(new String[0]);}}display("Actual Email Ids :");displayArray(strArray);return strArray;}public static void display(String str){if("LOCAL".equals(Config.STAGING_REG)){//if(str.startsWith("1000")) log.info(str);}}public static void displaySameLine(String str,String sep){if("LOCAL".equals(Config.STAGING_REG)){ log.info(str);}}public static void displayArray(String[] array){if(array != null && array.length>0){for(int i=0;i 10) { return YyyyMmDdDate; }else { month = YyyyMmDdDate.substring(5, 7); //firstSlash = YyyyMmDdDate.substring(4, 5); firstSlash ="-"; day = YyyyMmDdDate.substring(8, 10); secondSlash = YyyyMmDdDate.substring(7,8); year = YyyyMmDdDate.substring(0, 4); secondSlash="-"; return month+"/"+day+"/"+year; }}public static String convertToString(String arrays[]){if(arrays == null || arrays.length ==0) return "";String val = "";for(int i=0;i