Here you can find the source of vectorToNickNameArray(Vector nicksAndPaths)
Parameter | Description |
---|---|
nicksAndPaths | - vector of library name and path lines |
public static String[] vectorToNickNameArray(Vector nicksAndPaths)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { /**//from w ww .j a v a2 s . co m * vectorToNickNameArray * @param nicksAndPaths - vector of library name and path lines * @return - an array of string * todo: change to java's Property class */ public static String[] vectorToNickNameArray(Vector nicksAndPaths) { int i, j; String line; i = 0; j = 0; int sz = nicksAndPaths.size(); String[] result_buffer = new String[sz]; String temp; while (i < sz) { // first element in string is nick name line = ((String) nicksAndPaths.elementAt(i)).trim(); if (line.length() > 0) { temp = parseOutLibNickName(line); if (temp == null || temp.length() == 0) { return (null); } else { result_buffer[j] = temp; j++; } } i++; } return (result_buffer); } /** * parseOutLibNickName * @param line - line to parse nickname from * @return String * todo: change to java's Property class */ public static String parseOutLibNickName(String line) { int spacenum; String resultBuffer; // first element in string is nick name spacenum = line.indexOf("="); if (spacenum <= 0) { return (null); } else { resultBuffer = (line.substring(0, spacenum)).trim(); } return (resultBuffer); } }