Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c6436cf359f3edac85f1ee8d52072fe774bdfc27 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*****************************************************************************
 * Copyright (c) 2013 CEA LIST.
 *
 *    
 * 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:
 *  Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.infra.nattable.utils;


public class TableClipboardUtils {

	/**
	 * row separator in the clipboard contents
	 */
	public static final String ROW_SEPARATOR = "\n"; //$NON-NLS-1$

	/**
	 * column separator in the clipboard contents
	 */
	public static final String COLUMN_SEPARATOR = "\t"; //$NON-NLS-1$

	/**
	 * the separator used for multivalue
	 */
	public static final String MULTI_VALUE_SEPARATOR = ","; //$NON-NLS-1$

	private TableClipboardUtils() {
		//to prevent instanciation
	}

	/**
	 * 
	 * @param fullContents
	 *        a table represented by a String
	 * @return the rows for this table
	 */
	public static final String[] getRows(final String fullContents) {
		final String[] rows = fullContents.split(ROW_SEPARATOR);
		return rows;
	}

	/**
	 * 
	 * @param row
	 *        a row represented by a String
	 * @return the cells for this row
	 */
	public static final String[] getCells(final String row) {
		return row.split(COLUMN_SEPARATOR);
	}


}

Back to the top