/////////////////////////////////////////////////////////////////////////////////////////
| 691 | /// |
| 692 | /// |
| 693 | std::string title( const std::string & str ) |
| 694 | { |
| 695 | std::string s( str ); |
| 696 | std::string::size_type len = s.size(), i; |
| 697 | bool previous_is_cased = false; |
| 698 | |
| 699 | for ( i = 0; i < len; ++i ) |
| 700 | { |
| 701 | int c = s[i]; |
| 702 | if ( ::islower(c) ) |
| 703 | { |
| 704 | if ( !previous_is_cased ) |
| 705 | { |
| 706 | s[i] = ::toupper(c); |
| 707 | } |
| 708 | previous_is_cased = true; |
| 709 | } |
| 710 | else if ( ::isupper(c) ) |
| 711 | { |
| 712 | if ( previous_is_cased ) |
| 713 | { |
| 714 | s[i] = ::tolower(c); |
| 715 | } |
| 716 | previous_is_cased = true; |
| 717 | } |
| 718 | else |
| 719 | { |
| 720 | previous_is_cased = false; |
| 721 | } |
| 722 | } |
| 723 | |
| 724 | return s; |
| 725 | } |
| 726 | |
| 727 | ////////////////////////////////////////////////////////////////////////////////////////////// |
| 728 | /// |
no test coverage detected