fork(48) download
  1. class Ideone
  2. {
  3. public static void main (String[] args)
  4. {
  5. final String text = " foo ";
  6. System.out.println(text.replaceFirst("\\s++$", ""));
  7. }
  8. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
  foo