Here you can find the source of assertSplit(final String text, final int length)
public static String[] assertSplit(final String text, final int length)
//package com.java2s; /******************************************************************************* * Copyright (c) 2015 Vienna University of Technology. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from w w w. j a v a2 s . co m * Martin Fleck (Vienna University of Technology) - initial API and implementation * * Initially developed in the context of ARTIST EU project www.artist-project.eu *******************************************************************************/ public class Main { public static final String JAVA_DELIMITER_ESCAPED = "\\."; public static final String UML_DELIMITER = "::"; public static String[] assertSplit(final String text, final int length) { return assertSplit(text, length, "'" + text + "' must have at least " + length + " parts delimited by '.' or '::'."); } public static String[] assertSplit(final String text, final int length, final String message) { final String[] parts = split(text); if (parts.length != length) { throw new IllegalArgumentException(message); } return parts; } public static String[] split(final String text) { return text.split("(" + JAVA_DELIMITER_ESCAPED + "|" + UML_DELIMITER + ")"); } }