Changeset 274 for branches/LogicMail-1.0/LogicMail/src/org/logicprobe/LogicMail/util/StringParser.java
- Timestamp:
- 08/19/08 07:51:07 PM (5 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/LogicMail-1.0/LogicMail/src/org/logicprobe/LogicMail/util/StringParser.java
r254 r274 334 334 return buf.toString(); 335 335 } 336 336 337 337 /** 338 338 * Recursively parse a nested paren string. … … 359 359 boolean inQuote = false; 360 360 while(q < rawText.length()) { 361 if( rawText.charAt(q) == '\"') {361 if(isQuoteChar(rawText, q, p)) { 362 362 if(!inQuote) { 363 363 inQuote = true; … … 422 422 } 423 423 } 424 if(rawText.charAt(i) == '\"' && !subInQuote) { 424 425 if(isQuoteChar(rawText, i, q+1) && !subInQuote) { 425 426 subInQuote = true; 426 427 } 427 else if( rawText.charAt(i) == '\"'&& subInQuote) {428 else if(isQuoteChar(rawText, i, q+1) && subInQuote) { 428 429 subInQuote = false; 429 430 } … … 454 455 } 455 456 return parsedText; 457 } 458 459 /** 460 * Helper method to determine if a character is a quote. 461 */ 462 private static boolean isQuoteChar(String rawText, int index, int startIndex) 463 { 464 if(index == startIndex) { 465 return rawText.charAt(index) == '\"'; 466 } 467 else if(rawText.charAt(index) == '\"') { 468 if(rawText.charAt(index - 1) == '\\') { 469 if(index - 2 < startIndex || rawText.charAt(index - 2) == '\\') { 470 return true; 471 } 472 else { 473 return false; 474 } 475 } 476 else { 477 return true; 478 } 479 } 480 else { 481 return false; 482 } 456 483 } 457 484
