Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String getParsingData(String str) {
        String dd = str.substring(0, 15);
        String mock = "";
        try {
            String a = parseMockData(dd)[0].trim();
            String b = parseMockData(dd)[1].trim();
            String c = parseMockData(dd)[2].trim();
            if (a.compareTo("") != 0)
                mock = a + "#MD";
            else if (b.compareTo("") != 0)
                mock = b + "#ML";
            else if (c.compareTo("") != 0)
                mock = c + "#MS";
        } catch (Exception e) {
            String a = parseMockDataSec(dd)[0].trim();
            mock = a + "#ML";
        }

        return mock;
        // 2.6 2.5 -.-
    }

    public static String[] parseMockData(String str) {
        return str.split("[-][.][-][   ]");
    }

    public static String[] parseMockDataSec(String str) {
        return str.split("(\\d+\\.\\d)");
    }
}