Java to Php conversion

bobm

New Member
I have a function in Java which I need to convert into php. It converts unicode text into characters. For example input is "Every person haveue280 sumue340 ambition";I want to replace ue280, ue340 to \ue280, \ue340 with regular expressionHere is code written in Java\[code\]String in = "Every person haveue280 sumue340 ambition";Pattern p = Pattern.compile("u(\\p{XDigit}{4})"); Matcher m = p.matcher(in); StringBuffer buf = new StringBuffer(); while(m.find()) m.appendReplacement(buf, "" + (char) Integer.parseInt(m.group(1), 16)); m.appendTail(buf); String out = buf.toString();\[/code\]Is it possible to convert it into phpThanks in advance
 
Back
Top