Java tutorial
//package com.java2s; /** * Appcelerator Titanium Mobile * Copyright (c) 2011-2012 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. */ public class Main { protected static String[] getClassAndFieldNames(String path) { int lastDot = path.lastIndexOf('.'); String className = lastDot < 0 ? "" : path.substring(0, lastDot < 0 ? 1 : lastDot).replace('.', '$'); String fieldName = lastDot < 0 ? path : path.substring(lastDot + 1); return new String[] { className, fieldName }; } }