Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { private static int getColorKeySeparator(String title) { for (int i = title.length() - 1; i >= 0; i--) { char c = title.charAt(i); if ('0' <= c && c <= '9') continue; if ((c == '$') && (i + 1 < title.length())) return i; // $ and at least one digit break; } return -1; } }