aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/utils/SdcToscaUtility.java
blob: 77f7d551dc043e25d488ed9b81df0400bf8ca408 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package org.openecomp.sdc.tosca.parser.utils;

import java.util.regex.Pattern;

public class SdcToscaUtility {
	
	public final static Pattern COMPONENT_INSTANCE_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-]+");
	
	public static String normaliseComponentInstanceName(String name) {
		String normalizedName = name.toLowerCase();
		normalizedName = COMPONENT_INSTANCE_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
		String[] split = normalizedName.split(" ");
		StringBuffer sb = new StringBuffer();
		for (String splitElement : split) {
			sb.append(splitElement);
		}
		return sb.toString();
	}
}