【小兵php源码】【synchronize的源码】【光驱指标源码】appendreplacement源码分析
2024-12-24 09:46:06 来源:{typename type="name"/} 分类:{typename type="name"/}
1.javaçreplaceFirst
javaçreplaceFirst
æ¥éçè¡ä½ å¯ä»¥è·è¿å»çä¸æºç ï¼
å®çæºç æ¯è¿æ ·çï¼
int cursor = 0;
char nextChar = replacement.charAt(cursor);
if (nextChar == '\\') {
cursor++;
nextChar = replacement.charAt(cursor);
result.append(nextChar);
cursor++;
å ¶ä¸replacement为"\\",码分小兵php源码å¼å§è¿ä¸ªnextChar ä¼å¾å°æ¯'\'ï¼å ¶å®æ¯'\\'å®==â\\âï¼è¿å ¥æ¡ä»¶ï¼å次æ§è¡
replacement.charAt(1)çæ¶åæ¥éãå 为å符串"\\".length()æ¯1ï¼æ以è¶çäºãä½ æ³æ¿æ¢æ"\"éè¦æ¹æSystem.out.println("?".replaceFirst("\\?", "\\\\"));