Java examples for java.lang:Exception StackTrace
Splits the string on every token into an array of stack frames.
/*/*from www .j ava 2s . c o m*/ * Copyright 1997-2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //package com.java2s; import java.util.StringTokenizer; public class Main { /** * Splits the string on every token into an array of stack frames. * * @param string the string to split * @param onToken the token to split on * @return the resultant array * @deprecated This is an internal utility method that should not be used */ public static String[] splitString(final String string, final String onToken) { return splitStringInternal(string, onToken); } /** * Splits the string on every token into an array of stack frames. * * @param string the string to split * @param onToken the token to split on * @return the resultant array */ private static String[] splitStringInternal(final String string, final String onToken) { final StringTokenizer tokenizer = new StringTokenizer(string, onToken); final String[] result = new String[tokenizer.countTokens()]; for (int i = 0; i < result.length; i++) { result[i] = tokenizer.nextToken(); } return result; } }