【发布时间】:2016-02-04 00:07:06
【问题描述】:
我有以下字符串,我需要从中解析/提取“20000”。
"where f_id = '20000' and (flag is true or flag is null)"
对最好的方法有什么建议吗?
这里有更多代码可以帮助理解:
List<ReportDto> reportDtoList = new ArrayList<ReportDto>();
for (Report report : reportList) {
List<ReportDetailsDto> ReportDetailsDtoList = new ArrayList<ReportDetailsDto>();
ReportDto reportDto = new ReportDto();
reportDto.setReportId(report.getReportId());
reportDto.setReportName(report.getName());
Pattern p = Pattern.compile("=\\s'[0-9]+'");
String whereClause = report.getWhereClause();
Matcher m = p.matcher(whereClause);
不知道之后该怎么办?
【问题讨论】:
-
您的问题不完整。请添加更多细节。
-
split 就可以了
-
我基本上需要获取该数值并将其设置到我的 dto 中
-
str.replaceAll("\\D", "")
标签: java string parsing substring