Java String Clip ClipObjectReferenceAddress(String p_fullObjectReference)

Here you can find the source of ClipObjectReferenceAddress(String p_fullObjectReference)

Description

Sometimes it is convenient for logging purposes to be able to add the reference address so that you can track the life of a particular object more easily.

License

Open Source License

Parameter

Parameter Description
p_fullObjectReference a parameter

Declaration

static public String ClipObjectReferenceAddress(String p_fullObjectReference) 

Method Source Code

//package com.java2s;
/*/*from w w w .  j  ava2s.co m*/
   Copyright 2016 Wes Kaylor
    
   This file is part of CoreUtil.
    
   CoreUtil is free software: you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.
    
   CoreUtil is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Lesser General Public License for more details.
    
   You should have received a copy of the GNU Lesser General Public License
   along with CoreUtil.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    /*********************************
     * Sometimes it is convenient for logging purposes to be able to add the reference address
     * so that you can track the life of a particular object more easily.  This function takes
     * an object reference and gets just the address part out of it.
     * Ex.  ClipObjectReferenceAddress("" + t_newConnection)
     * There may be an easier way to get the string version of the reference address info, but
     * concatenating the reference with the empty string "" will do it.
     * @param p_fullObjectReference
     * @return
     */
    static public String ClipObjectReferenceAddress(String p_fullObjectReference) {
        return p_fullObjectReference.substring(p_fullObjectReference.indexOf('@') + 1);
    }
}

Related

  1. clip(final String s, final int leftClip, final int rightClip)
  2. clip(String characterItem)
  3. clip(String str, int startChars)
  4. clipString(String input, int numChars, boolean appendEllipses)
  5. clipText(String text, int maxLength)