MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenImageIO / title

Function title

src/libutil/pystring.cpp:693–725  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

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 ///

Callers 1

pystring.hFile · 0.85

Calls 3

islowerFunction · 0.85
isupperFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected