BioC++ core-0.7.0
The Modern C++ libraries for Bioinformatics.
 
Loading...
Searching...
No Matches
to_lower.hpp
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2022 deCODE Genetics
3// Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
4// Copyright (c) 2016-2020, Knut Reinert & MPI für molekulare Genetik
5// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
6// shipped with this file and also available at: https://github.com/biocpp/biocpp-core/blob/main/LICENSE.md
7// -----------------------------------------------------------------------------------------------------
8
9#pragma once
10
11#include <bio/core.hpp>
12
20namespace bio::alphabet::detail
21{
22
24constexpr bool is_lower(char const c)
25{
26 return (c >= 'a' && c <= 'z');
27}
28
30constexpr bool is_upper(char const c)
31{
32 return (c >= 'A' && c <= 'Z');
33}
34
40constexpr char to_lower(char const c)
41{
42 return static_cast<char>(static_cast<unsigned char>(c) | 0b0010'0000);
43}
44
50constexpr char to_upper(char const c)
51{
52 return static_cast<char>(static_cast<unsigned char>(c) & 0b0101'1111);
53}
54
55} // namespace bio::alphabet::detail
Provides platform and dependency checks.
auto const to_upper
A view that converts each element to upper case.
Definition: to_upper.hpp:68
auto const to_lower
A view that converts each element to lower case.
Definition: to_lower.hpp:68