西装革履遭观众围堵,特殊符号

by admin on 2019年5月25日

2013年10月24日,林丹武汉出席商业活动,西装革履引粉丝惊叫连连

工作中突然发现split不能正常使用了,查看了源码才发现是特殊字符,对于这种情况可以以下方法解决:

 

关于点的问题是用string.split 解决。关于竖线的问题用
string.split解决。关于星号的问题用 string.split解决。关于斜线的问题用
sring.split解决。关于中括号的问题用
sring.split(“[\[\](file://[永利皇宫官网,//)]”)解决。

永利皇宫官网 1

研究下java 源码可以发现遇到这些特殊字符会抛出异常

永利皇宫官网 2

public final class Pattern implements java.io.Serializable{ private Node sequence { Node head = null; Node tail = null; Node node = null; LOOP: for  { int ch = peek(); switch  { case '(': // Because group handles its own closure, // we need to treat it differently node = group0(); // Check for comment or flag group if (node == null) continue; if (head == null) head = node; else tail.next = node; // Double return: Tail was returned in root tail = root; continue; case '[': node = clazz; break; case '\\': ch = nextEscaped(); if (ch == 'p' || ch == 'P') { boolean oneLetter = true; boolean comp = (ch == 'P'); ch = next(); // Consume { if present if (ch != '{') { unread(); } else { oneLetter = false; } node = family(oneLetter).maybeComplement; } else { unread(); node = atom(); } break; case '^': next(); if (has(MULTILINE)) { if (has(UNIX_LINES)) node = new UnixCaret(); else node = new Caret(); } else { node = new Begin(); } break; case '$': next(); if (has(UNIX_LINES)) node = new UnixDollar(has(MULTILINE)); else node = new Dollar(has(MULTILINE)); break; case '.': next(); if (has { node = new All(); } else { if (has(UNIX_LINES)) node = new UnixDot(); else { node = new Dot(); } } break; case '|': case ')': break LOOP; case ']': // Now interpreting dangling ] and } as literals case '}': node = atom(); break; case '?': case '*': case '+': next(); throw error("Dangling meta character '" +  + "'"); case 0: if (cursor >= patternLength) { break LOOP; } // Fall through default: node = atom(); break; } node = closure; if (head == null) { head = tail = node; } else { tail.next = node; tail = node; } } if (head == null) { return end; } tail.next = end; root = tail; //double return return head; }}

永利皇宫官网 3

永利皇宫官网 4

永利皇宫官网 5

永利皇宫官网 6

永利皇宫官网 7

永利皇宫官网 8

永利皇宫官网 9

永利皇宫官网 10

 

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图