Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * @param source
     * @param name
     * @return
     */
    private static int getTagPos(String source, String name) {
        int pos = -1;
        if (source == null || source.isEmpty() || name == null || name.isEmpty())
            return pos;

        int start;
        String temp = source;

        while ((start = temp.indexOf(name)) >= 0) {
            temp = temp.substring(start);
            if (temp.charAt(name.length()) == ' ' || temp.charAt(name.length()) == '=')
                return start;

            temp = temp.substring(name.length());
        }

        return pos;
    }
}