FileDocCategorySizeDatePackage
NameReversalFilter.javaAPI DocMyID3 for Android1086Tue Oct 07 11:15:24 BST 2008org.cmc.music.clean

NameReversalFilter

public class NameReversalFilter extends RenamingFileFilter

Fields Summary
Constructors Summary
Methods Summary
protected java.lang.StringgetNewName2(java.io.File file, java.lang.String s)

		if (!file.isFile())
			return null;

		int first_index = s.indexOf('-");
		int last_index = s.lastIndexOf('-");
		if (first_index < 0)
		{
			System.out.println("---------------------------------------------");
			System.out.println("\tNo hyphen, skipping: '" + s + "'");
		}
		else if (first_index != last_index)
		{
			System.out.println("---------------------------------------------");
			System.out.println("\tmore than one hyphen, skipping: '" + s + "'");
		}
		else
		{
			String left = s.substring(0, first_index);
			String right = s.substring(first_index + 1);
			String new_s = right + " - " + left;
			System.out.println("'" + s + "' -> '" + new_s + "'");
			return new_s;
		}

		return null;