I have a string contains multi language text as follow
{|en|}Audio Albums{|/en|}{|ar|}الألبومات الصوتية{|/ar|}
I need a function to get the text of specific language
getText("en") should returns Audio Albums
I think I have to use regular expression.
This should work:
Pattern pattern = Pattern.compile("\{\|"+lang+"\\|\\}(.*)\\{\\|/"+lang+"\|\}");
Matcher matcher = pattern.matcher(content);
return matcher.find() ? matcher.group(1) : null;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.