package de.hsadmin.core.util;

public class TextUtil {

	public static String replaceUmlautCharacters(String umlautString) {
		StringBuffer buffer = new StringBuffer();
		for (char c : umlautString.toCharArray()) {
			if (	(c >= 'a' && c <= 'z') ||
					(c >= 'A' && c <= 'Z') ||	
					(c >= '0' && c <= '9') || 	
					(c == ' ') ) {
						buffer.append(c);
			} else {
				switch (c) {
				case 'ä':
					buffer.append("ae");
					break;
				case 'ö':
					buffer.append("oe");
					break;
				case 'ü':
					buffer.append("ue");
					break;
				case 'Ä':
					buffer.append("Ae");
					break;
				case 'Ö':
					buffer.append("Oe");
					break;
				case 'Ü':
					buffer.append("Ue");
					break;
				case 'ß':
					buffer.append("ss");
					break;
				default:
					buffer.append('-');
					break;
				}
			}
		}
		return buffer.toString();
	}

}
