[英]Upper case conversion - convert the first letter of each word in the string to uppercase
[英]Split the string from first Upper case letter
我想使用 java 從此文本中提取文件名和時間戳
invoice_12890.pdf2019 年 4 月 10 日上午 8:33:16
預計
boolean hadDot=false;//this makes sure we don't split before finding the file extension
String file="",date="";
for(int i=0;i<text.length();i++){
if(text.charAt(i)=='.'){
hadDot=true;
continue;
}
if(hadDot&&Character.isUpperCase(text.charAt(i))){
file=text.substring(0,i);
date=text.substring(i);
break;
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.