Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.BufferedReader;

import java.io.FileReader;

import java.io.IOException;

public class Main {
    public static String GetIniValue(String filename, String variable) {
        try {
            BufferedReader bProcFS = new BufferedReader(new FileReader(filename));
            String readLine = null;
            while ((readLine = bProcFS.readLine()) != null) {
                if (readLine.startsWith(variable)) {
                    bProcFS.close();
                    return readLine.split("=")[1];
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "";
    }
}