Java tutorial
//package com.java2s; public class Main { private static String extractEncoding(String hdr) { int i = hdr.indexOf("encoding="); //$NON-NLS-1$ if (i == -1) return null; hdr = hdr.substring(i + 9); char sep = hdr.charAt(0); hdr = hdr.substring(1); i = hdr.indexOf(sep); if (i == -1) return null; return hdr.substring(0, i); } }