All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.davfx.string.EscapingStringInput Maven / Gradle / Ivy

The newest version!
package com.davfx.string;

final class EscapingStringInput implements StringInput {
	private final String raw;

	public EscapingStringInput(String raw) {
		StringBuilder b = new StringBuilder();
		boolean escaping = false;
		for (int i = 0; i < raw.length(); i++) {
			char c = raw.charAt(i);
			if (escaping) {
				escaping = false;
				b.append(c);
			} else if (c == '\\') {
				escaping = true;
			} else {
				b.append(c);
			}
		}
		this.raw = b.toString();
	}
	@Override
	public String get(T h) {
		return raw;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy