equal
deleted
inserted
replaced
444 const TInt end = aText.Length() - 1; |
444 const TInt end = aText.Length() - 1; |
445 TInt pos = end; |
445 TInt pos = end; |
446 while(pos > 0) |
446 while(pos > 0) |
447 { |
447 { |
448 const TUint16 word = aText[--pos]; |
448 const TUint16 word = aText[--pos]; |
449 if(word == ' ' || word == 0x2029) |
449 // Since in most cases, URL is comprised of ASCII characters, |
450 { |
450 // so if there is a character out of the ASCII printable characters, |
|
451 // we can stop the search. |
|
452 const TInt KMinPrintableAscIIChar( 0x21 ); // excluding space |
|
453 const TInt KMaxPrintableAscIIChar( 0x7e ); |
|
454 if( word < KMinPrintableAscIIChar || word > KMaxPrintableAscIIChar ) |
|
455 { |
|
456 pos++; // make the string begin with printable character. |
451 break; |
457 break; |
452 } |
458 } |
453 } |
459 } |
454 |
460 |
455 TInt length = end - pos; |
461 TInt length = end - pos; |
459 pos = field.Find(_L(":\\\\")); |
465 pos = field.Find(_L(":\\\\")); |
460 if(KErrNotFound == pos) pos = field.Find(_L("://")); |
466 if(KErrNotFound == pos) pos = field.Find(_L("://")); |
461 if(KErrNotFound != pos) |
467 if(KErrNotFound != pos) |
462 { |
468 { |
463 return ETrue; |
469 return ETrue; |
464 } |
470 } |
|
471 else |
|
472 { |
|
473 // Although the string doesn't contain '://', it is also considered |
|
474 // as an URL if it contains 'www.'. |
|
475 HBufC* fieldTextBuf( field.Alloc() ); |
|
476 if ( fieldTextBuf ) |
|
477 { |
|
478 TPtr fieldText( fieldTextBuf->Des() ); |
|
479 // Use lower case for search to avoid case sensitive mismatch. |
|
480 fieldText.LowerCase(); |
|
481 TBool result( fieldText.Find( _L("www.") ) != KErrNotFound ); |
|
482 delete fieldTextBuf; |
|
483 return result; |
|
484 } |
|
485 } |
465 } |
486 } |
466 |
487 |
467 return EFalse; |
488 return EFalse; |
468 } |
489 } |
469 |
490 |