Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Dev#226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
schmouk merged 222 commits intomainfromdev
Jul 16, 2025
Merged

Dev#226

Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
222 commits
Select commitHold shift + click to select a range
a428322
#3 - Create Visual Studio 2022 project
schmoukMar 7, 2023
b3d0cbc
#2 - Create empty module cppstrings.h.
schmoukMar 7, 2023
0b4227d
#3 - Create Visual Studio 2022 project
schmoukMar 7, 2023
41767da
#4 - Modify .gitignore
schmoukMar 7, 2023
5fc2724
#6 - Implement specialized class CppString
schmoukMar 8, 2023
f7dd584
#7 - Implement specialized class CppWString
schmoukMar 8, 2023
afa1687
#5 - Create templated base class CppStringT<>
schmoukMar 8, 2023
266fe34
#60 - Implement method is_punctuation
schmoukMar 9, 2023
3fd2973
#30 - Implement method CppStringT::isspace()
schmoukMar 9, 2023
b606e4d
#60 - Implement method is_punctuation
schmoukMar 9, 2023
f28a337
#30 - Implement method CppStringT::isspace()
schmoukMar 9, 2023
c12ba5f
#61- Implement method is_words_sep
schmoukMar 9, 2023
a45bc56
#35 - Implement method CppStringT::lower()
schmoukMar 9, 2023
9fb272f
#55 - Implement method CppStringT::upper()
schmoukMar 9, 2023
60782bb
#8 - Implement method CppStringT::capitalize()
schmoukMar 9, 2023
a3c86ef
#10 - Implement method CppStringT::center()
schmoukMar 9, 2023
1dee9cf
#16 - Implement method CppStringT::find()
schmoukMar 10, 2023
9fe08ff
#11 - Implement method CppStringT::count()
schmoukMar 10, 2023
f3cfc00
#12 - Implement method CppStringT::count_n()
schmoukMar 10, 2023
224de07
#17 - Implement method CppStringT::find_n()
schmoukMar 10, 2023
f82fc5d
#62 - Implement exception CppStringT::NotFoundException
schmoukMar 10, 2023
fc98a07
#19 - Implement method CppStringT::index()
schmoukMar 10, 2023
b428966
#20 - Implement method CppStringT::index_n()
schmoukMar 10, 2023
c368826
#42 - Implement method CppStringT::rfind()
schmoukMar 10, 2023
5d49ab1
#43 - Implement method CppStringT::rindex()
schmoukMar 10, 2023
895404b
#66 - Fix methods find() and find_n()
schmoukMar 10, 2023
8a666e5
#67 - Fix methods index() and index_n()
schmoukMar 10, 2023
7eb0631
#68 - Fix method rfind()
schmoukMar 10, 2023
14ecbfe
#64 - Implement method rfind_n()
schmoukMar 10, 2023
2c76cd6
#69 - Fix method rindex()
schmoukMar 10, 2023
eab2dab
#65 - Implement method rindex_n()
schmoukMar 11, 2023
e3d8f11
#13 - Implement method CppStringT::endswith()
schmoukMar 11, 2023
11cae64
#14 - Implement method CppStringT::endswith_n()
schmoukMar 11, 2023
14054fb
#15 - Implement method CppStringT::expand_tabs()
schmoukMar 11, 2023
4b0c706
#21 - Implement method CppStringT::isalnum()
schmoukMar 11, 2023
6ca96ba
#22 - Implement method CppStringT::isalpha()
schmoukMar 11, 2023
0f1e18f
#71 - Modify method is_punctuation()
schmoukMar 11, 2023
f4c308c
#70 - Modify method is_space()
schmoukMar 11, 2023
4903ec2
#23 - Implement method CppStringT::isascii()
schmoukMar 12, 2023
66d1acd
#24 - Implement method CppStringT::isdecimal()
schmoukMar 12, 2023
0bd3d0a
#25 - Implement method CppStringT::isdigit()
schmoukMar 12, 2023
27edefc
#26 - Implement method CppStringT::isidentifier()
schmoukMar 12, 2023
b41823b
#27 - Implement method CppStringT::islower()
schmoukMar 12, 2023
f8f6970
#28 - Implement method CppStringT::isnumeric()
schmoukMar 12, 2023
46387e1
#29 - Implement method CppStringT::isprintable()
schmoukMar 12, 2023
bee370f
#31 - Implement method CppStringT::istitle()
schmoukMar 12, 2023
4ee68e3
#32 - Implement method CppStringT::isupper()
schmoukMar 12, 2023
e0f0489
#33 - Implement method CppStringT::join()
schmoukMar 12, 2023
fad6641
#34 - Implement method CppStringT::ljust()
schmoukMar 12, 2023
b6b54d6
#36 - Implement method CppStringT::lstrip()
schmoukMar 12, 2023
76a222e
#38 - Implement method CppStringT::partition()
schmoukMar 12, 2023
a9733c0
#39 - Implement method CppStringT::removeprefix()
schmoukMar 12, 2023
de3e8e0
#40 - Implement method CppStringT::removesuffix()
schmoukMar 12, 2023
f788380
#41 - Implement method CppStringT::replace()
schmoukMar 12, 2023
faaa942
#44 - Implement method CppStringT::rjust()
schmoukMar 12, 2023
8126e7a
#41 - Implement method CppStringT::replace()
schmoukMar 12, 2023
6d3729e
#45 - Implement method CppStringT::rpartition()
schmoukMar 12, 2023
b235aef
#46 - Implement method CppStringT::rsplit()
schmoukMar 13, 2023
861e82c
#73 - Refactor method CppStringT::rsplit()
schmoukMar 14, 2023
a66f7b5
#47 - Implement method CppStringT::rstrip()
schmoukMar 14, 2023
2424122
#48 - Implement method CppStringT::split()
schmoukMar 14, 2023
90310d7
#49 - Implement method CppStringT::splitlines()
schmoukMar 14, 2023
0b9b7e7
#50 - Implement method CppStringT::startswith()
schmoukMar 15, 2023
9845bab
#74 - Implement method CppStringT::startswith_n()
schmoukMar 15, 2023
7351b16
#51 - Implement method CppStringT::strip()
schmoukMar 15, 2023
00815f4
#52 - Implement method CppStringT::swapcase()
schmoukMar 15, 2023
6996af3
#53 - Implement method CppStringT::title()
schmoukMar 15, 2023
65b40a7
#56 - Implement method CppStringT::zfill()
schmoukMar 16, 2023
42928ad
#75 - Implement method CppStringT::substr()
schmoukMar 16, 2023
122dfd1
#57 - Implement operator ""cs
schmoukMar 16, 2023
a7aab2b
#58 - Implement operator ""csv
schmoukMar 16, 2023
9e8fa92
#37 - Implement method CppStringT::maketrans()
schmoukMar 17, 2023
1e776b1
#76 - Enhance class CppStringT::TransTable
schmoukMar 17, 2023
cfdb448
#54 - Implement method CppStringT::translate()
schmoukMar 17, 2023
090b04c
#77 - Create a unit test solution in a new branch dev/tests
schmoukMar 17, 2023
0bddd1f
#77 - Create a unit test solution in a new branch dev/tests
schmoukMar 18, 2023
516d824
#78 - Test pcs::is_alpha() for char and wchar_t
schmoukMar 18, 2023
11e0bb7
#79 - Test pcs::is_ascii() for char and wchar_t
schmoukMar 18, 2023
23f2290
#80 - Test pcs::is_decimal() for char and wchar_t
schmoukMar 18, 2023
b4f6791
#81 - Test pcs::is_id_continue() for char and wchar_t
schmoukMar 18, 2023
7964ace
#82 - Test pcs::is_id_start() for char and wchar_t
schmoukMar 18, 2023
6edec7a
#83 - Test pcs::is_lower() for char and wchar_t
schmoukMar 18, 2023
aa12293
84 - Test pcs::is_printable() for char and wchar_t
schmoukMar 18, 2023
d0a6f1c
#85 - Test pcs::is_punctuation() for char and wchar_t
schmoukMar 18, 2023
0eacd20
#86 - Test pcs::is_space() for char and wchar_t
schmoukMar 18, 2023
0575557
#87 - Test pcs::is_upper() for char and wchar_t
schmoukMar 18, 2023
2d6e5cd
#88 - Test pcs::swap_case() for char and wchar_t
schmoukMar 18, 2023
060d0e6
#89 - Test pcs::to_lower() for char and wchar_t
schmoukMar 18, 2023
d4d697b
#90 - Test pcs::to_upper() for char and wchar_t
schmoukMar 18, 2023
37f45be
#91 - Test pcs::operator""cs for char and wchar_t
schmoukMar 18, 2023
435385f
#92 - Test pcs::operator""csv for char and wchar_t
schmoukMar 18, 2023
345ed73
#93 - Test CppStringT::TransTable constructor #1 with char and wchar_t
schmoukMar 18, 2023
166e6e2
#94 - Test CppStringT::TransTable constructor #2 with char and wchar_t
schmoukMar 18, 2023
151260c
#95 - Test CppStringT::TransTable constructor #3 with char and wchar_t
schmoukMar 18, 2023
7f12c48
#96 - Test CppStringT::TransTable constructor #4 with char and wchar_t
schmoukMar 18, 2023
61cdb2e
#97 - Test CppStringT::TransTable constructor #5 with char and wchar_t
schmoukMar 18, 2023
59d8d80
#98 - Test CppStringT::TransTable constructor #6 with char and wchar_t
schmoukMar 18, 2023
adde769
#99 - Test CppStringT::TransTable constructor #7 with char and wchar_t
schmoukMar 18, 2023
6e166c8
#100 - Test CppStringT::TransTable constructor #8 with char and wchar_t
schmoukMar 19, 2023
de72dc6
#101 - Test CppStringT::TransTable constructor #9 with char and wchar_t
schmoukMar 19, 2023
e861148
#104 - Test CppStringT::TransTable empty constructor with char and wc…
schmoukMar 19, 2023
4d1fa4d
#105 - Test CppStringT::TransTable copy constructor with char and wch…
schmoukMar 19, 2023
320109e
#106 - Test CppStringT::TransTable move constructor with char and wch…
schmoukMar 19, 2023
8a94ae4
#107 - Test CppStringT::TransTable copy assignment with char and wchar_t
schmoukMar 19, 2023
755de78
#108 - Test CppStringT::TransTable move assignment with char and wchar_t
schmoukMar 19, 2023
e67fa5a
#109 - Test CppStringT::TransTable std::map-assignment with char and …
schmoukMar 19, 2023
b9efdfe
#110 - Test CppStringT::TransTable::operator[] with char and wchar_t
schmoukMar 19, 2023
31399dd
#111 - Test CppStringT empty constructor with char and wchar_t
schmoukMar 19, 2023
8b862ac
#112 - Test CppStringT copy constructor with char and wchar_t
schmoukMar 19, 2023
8ada1a9
#113 - Test CppStringT move constructor with char and wchar_t
schmoukMar 19, 2023
f39c9aa
#114 - Test CppStringT constructor #6 with char and wchar_t
schmoukMar 19, 2023
ab90c70
#115 - Test CppStringT constructor #7 with char and wchar_t
schmoukMar 19, 2023
8893fd5
#116 - Test CppStringT constructor #8 with char and wchar_t
schmoukMar 19, 2023
c6268ec
#117 - Test CppStringT constructor #9 with char and wchar_t
schmoukMar 19, 2023
fb662fc
#118 - Test CppStringT constructor #10 with char and wchar_t
schmoukMar 19, 2023
ceebe19
#119 - Test CppStringT constructor #11 with char and wchar_t
schmoukMar 19, 2023
b02b516
#120 - Test CppStringT constructor #12 with char and wchar_t
schmoukMar 19, 2023
cf190aa
#121 - Test CppStringT constructor #13 with char and wchar_t
schmoukMar 19, 2023
6c41fde
#122 - Test CppStringT constructor #14 with char and wchar_t
schmoukMar 19, 2023
487b5cc
#123 - Test CppStringT constructor #15 with char and wchar_t
schmoukMar 19, 2023
401945c
#124 - Test CppStringT constructor #16 with char and wchar_t
schmoukMar 19, 2023
e53011d
#179 - Test CppStringT constructor #19 with char and wchar_t
schmoukMar 19, 2023
b1c2abc
#127 - Test CppStringT::capitalize() with char and wchar_t
schmoukMar 19, 2023
9814e6d
#128 - Test CppStringT::center() with char and wchar_t
schmoukMar 19, 2023
a54feb6
#129 - Test CppStringT::count() with char and wchar_t
schmoukMar 19, 2023
97f6bb1
#130 - Test CppStringT::count_n() with char and wchar_t
schmoukMar 19, 2023
33b1083
#131 - Test CppStringT::ends_with() with char and wchar_t
schmoukMar 19, 2023
ef16d45
#132 - Test CppStringT::ends_with_n() with char and wchar_t
schmoukMar 19, 2023
acd45ac
#133 - Test CppStringT::expand_tabs() with char and wchar_t
schmoukMar 19, 2023
fb4586d
#186 - Implement new signatures for method CppStringT::find()
schmoukMar 20, 2023
1c6ce39
#187 - Implement new signatures for CppStringT::find_n()
schmoukMar 20, 2023
63bcf2a
#187 - Implement new signatures for CppStringT::find_n()
schmoukMar 20, 2023
cc418b2
#134 - Test CppStringT::find() with char and wchar_t
schmoukMar 20, 2023
7636c39
#135 - Test CppStringT::find_n() with char and wchar_t
schmoukMar 20, 2023
403a87c
#190 - Implement new signatures for method CppStringT::index()
schmoukMar 21, 2023
e9bbcdd
#136 - Test CppStringT::index() with char and wchar_t
schmoukMar 21, 2023
951d497
#191 - Implement new signatures for method CppStringT::index_n()
schmoukMar 21, 2023
a12477b
#137 - Test CppStringT::index_n() with char and wchar_t
schmoukMar 21, 2023
4ec3564
#138 - Test CppStringT::isalnum() with char and wchar_t
schmoukMar 21, 2023
3fdad29
#139 - Test CppStringT::isalpha() with char and wchar_t
schmoukMar 21, 2023
4dc817f
#140 - Test CppStringT::isascii() with char and wchar_t
schmoukMar 21, 2023
f4588b8
#141 - Test CppStringT::isdecimal() with char and wchar_t
schmoukMar 21, 2023
b981f6a
#142 - Test CppStringT::isdigit() with char and wchar_t
schmoukMar 21, 2023
2c3c035
#145 - Test CppStringT::isnumeric() with char and wchar_t
schmoukMar 21, 2023
177811d
#143 - Test CppStringT::isidentifier() with char and wchar_t
schmoukMar 22, 2023
365319f
#144 - Test CppStringT::islower() with char and wchar_t
schmoukMar 22, 2023
33f809f
#146 - Test CppStringT::isprintable() with char and wchar_t
schmoukMar 22, 2023
740ee0f
#147 - Test CppStringT::ispunctuation() with char and wchar_t
schmoukMar 22, 2023
7ca47c7
#148 - Test CppStringT::isspace() with char and wchar_t
schmoukMar 22, 2023
b1c0e4c
#149 - Test CppStringT::istitle() with char and wchar_t
schmoukMar 22, 2023
474642e
#150 - Test CppStringT::isupper() with char and wchar_t
schmoukMar 22, 2023
43f92f7
#151 - Test CppStringT::is_words_sep() with char and wchar_t
schmoukMar 22, 2023
aba3db6
#152 - Test `CppStringT::join()` with `char` and `wchar_t`
schmoukMay 12, 2023
383adcd
#153 - Test CppStringT::ljust() with char and wchar_t
schmoukMay 12, 2023
78c5ebc
#154 - Test CppStringT::lower() with char and wchar_t
schmoukMay 12, 2023
c7a867b
#155 - Test CppStringT::lstrip() with char and wchar_t
schmoukMay 13, 2023
98a85fb
#156 - Test CppStringT::partition() with char and wchar_t
schmoukMay 13, 2023
e85bfc9
#157 - Test CppStringT::removeprefix() with char and wchar_t
schmoukMay 13, 2023
6faba8d
#158 - Test CppStringT::removesuffix() with char and wchar_t
schmoukMay 13, 2023
56b7326
#159 - Test CppStringT::replace() with char and wchar_t
schmoukNov 27, 2023
2c30532
#160 - Test CppStringT::rfind() with char and wchar_t
schmoukNov 28, 2023
6ff8a0f
#196 - Extend and fix tests on find() and index() methods
schmoukDec 2, 2023
cbcaae5
#161 - Test CppStringT::rfind_n() with char and wchar_t
schmoukDec 5, 2023
db2e408
#199-refactor tests
schmoukJul 7, 2025
866069a
#162-Test CppStringT::rindex() with char and wchar_t
schmoukJul 7, 2025
beafb01
#163-Test CppStringT::rindex_n() with char and wchar_t
schmoukJul 7, 2025
8b5c5b9
#163-Test CppStringT::rindex_n() with char and wchar_t
schmoukJul 7, 2025
e3cf5e3
#164-Test CppStringT::rjust() with char and wchar_t
schmoukJul 7, 2025
37d0dc8
#164-Test CppStringT::rjust() with char and wchar_t
schmoukJul 7, 2025
96f452c
#165-Test CppStringT::rpartition() with char and wchar_t
schmoukJul 7, 2025
1062816
#165-Test CppStringT::rpartition() with char and wchar_t
schmoukJul 7, 2025
80c3288
#166-Test CppStringT::rsplit() with char and wchar_t
schmoukJul 9, 2025
19d9688
#166-Test CppStringT::rsplit() with char and wchar_t
schmoukJul 9, 2025
f1f476b
#167-Test CppStringT::rstrip() with char and wchar_t
schmoukJul 9, 2025
c892008
#168-Test CppStringT::split() with char and wchar_t
schmoukJul 9, 2025
90d8397
#169-Test CppStringT::splitlines() with char and wchar_t
schmoukJul 10, 2025
446cb8e
#200-modify .ignore and VS projects to compile and test 32-bits platf…
schmoukJul 10, 2025
a11502e
#170-Test CppStringT::startswith() with char and wchar_t
schmoukJul 10, 2025
9005fb0
#171-Test CppStringT::startswith_n() with char and wchar_t
schmoukJul 10, 2025
6575060
#172-Test CppStringT::strip() with char and wchar_t
schmoukJul 10, 2025
41860e7
#173-Test CppStringT::substr() with char and wchar_t
schmoukJul 10, 2025
ce29faf
#174-Test CppStringT::swapcase() with char and wchar_t
schmoukJul 11, 2025
52404a8
#175-Test CppStringT::title() with char and wchar_t
schmoukJul 11, 2025
f95e30f
#176-Test CppStringT::translate() with char and wchar_t
schmoukJul 11, 2025
aa60e6a
#177-Test CppStringT::upper() with char and wchar_t
schmoukJul 11, 2025
e3ff5ce
#178-Test CppStringT::zfill() with char and wchar_t
schmoukJul 11, 2025
7588cb6
#202-add test on nullptr in CppStringT pointer constructors
schmoukJul 11, 2025
873d6d1
#182-Implement method CppStringT::contains()
schmoukJul 11, 2025
60f5163
#184-Test method CppStringT::contains()
schmoukJul 11, 2025
c269f62
#183-Implement method CppStringT::contains_n()
schmoukJul 11, 2025
016bdfd
#183-Implement method CppStringT::contains_n()
schmoukJul 11, 2025
fbde103
#185-Test method CppStringT::contains_n()
schmoukJul 11, 2025
20c35e8
#180-Implement CppStringT::operator* ()
schmoukJul 11, 2025
1559542
#181-Test CppStringT::operator* ()
schmoukJul 11, 2025
042fcca
#203-remove signatures with c-strings and chars
schmoukJul 11, 2025
83f468c
#208-implement slices
schmoukJul 12, 2025
43f4bbd
#208-implement slices
schmoukJul 12, 2025
3f25a77
#209-test slices
schmoukJul 13, 2025
f512977
#194-Implement operator () with slices
schmoukJul 13, 2025
5aa3489
#195-Test operator () with slices
schmoukJul 13, 2025
96ccdf7
#210-remove string_views stuff.
schmoukJul 13, 2025
b3dc949
#211-fix c++ and c standards for every projects, configurations and p…
schmoukJul 13, 2025
e986ede
#18-Implement method CppStringT::format()
schmoukJul 13, 2025
18f4f7d
#18-Implement method CppStringT::format()
schmoukJul 15, 2025
bccb85b
#205-test method CppStringT::format()
schmoukJul 15, 2025
2074216
#217-set VS project to c++20 and c17
schmoukJul 15, 2025
6110a76
#207-Add namespace pcs when missing in tests
schmoukJul 15, 2025
b9ae59c
#206-fix missing \briefs in doxygen strings
schmoukJul 15, 2025
2ee7546
#212-add attribute [[nodiscard]] at any useful place
schmoukJul 15, 2025
2348d3c
#219-modify copyright dates
schmoukJul 15, 2025
19d3913
#213-add attribute [[likely]] and [[unlikely]]
schmoukJul 16, 2025
7a79232
Merge pull request #221 from schmouk/tests
schmoukJul 16, 2025
685553f
#204-create PCS documentation
schmoukJul 16, 2025
7a771e2
#204-create PCS documentation
schmoukJul 16, 2025
96c75d6
#204-create PCS documentation
schmoukJul 16, 2025
4fda9ec
Update README.md
schmoukJul 16, 2025
2e1ad62
#204
schmoukJul 16, 2025
cac9c07
#224-generate doxygen documentation
schmoukJul 16, 2025
061477d
#204-create PCS documentation
schmoukJul 16, 2025
7382f6b
#223-cpp-strings VS project clean-up
schmoukJul 16, 2025
7d902d3
#222-simplify .gitignore
schmoukJul 16, 2025
7df48fc
Merge pull request #225 from schmouk/documentation
schmoukJul 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 6 additions & 19 deletions.gitignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,26 +7,13 @@
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Visual Studio specifics
.vs
x64
Debug
Release
105 changes: 104 additions & 1 deletionREADME.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,105 @@
# cpp-strings
# Library cpp-strings
[![license](http://img.shields.io/github/license/schmouk/cpp-strings.svg?style=plastic&labelColor=blueviolet&color=lightblue)](https://github.com/schmouk/cpprandlib/license) [![Latest release](http://img.shields.io/github/release/schmouk/cpp-strings.svg?style=plastic&labelColor=blueviolet&color=success)](https://github.com/schmouk/cpprandlib/releases) [![code_coverage](https://img.shields.io/badge/code_coverage-100%25-success?style=plastic&labelColor=blueviolet)]() [![tests](https://img.shields.io/badge/tests-passing-success?style=plastic&labelColor=blueviolet)]()

github repository: [https://github.com/schmouk/pythonic-cpp-strings](https://github.com/schmouk/pythonic-cpp-strings)

What if c++ strings where as easy to use as Python strings?

Let's just use c++ strings as are Python ones, with same API or as similar API as possible.
Library **cpp-strings** is fully templated. Just download header file `cppstrings.h` and put it anywhere in your project. Notice: all of its stuff is declared and defined in namespace `pcs` - which stands for **P**ythonic **C**++ **S**trings.

* The templated class `pcs::CppStringT<>` defines all constructors and methods that implement the equivalent of Python strings API.
* Class `pcs::CppString` specializes the templated class with `char` characters.
* Class `pcs::CppWString` specializes the templated class with `wchar_t` characters.

**cpp-strings** is implemented with the currently most recent c++ standard available with gcc, clang and msvc c++ compilers, i.e. standard **c++20**.

* directory `cpp-strings` contains the header file `cppstring.h`.
This is the header file to include in your projects.
* directory `cpp-strings-tests` contains the unit-tests file `cpp-strings-tests.cpp`
This file tests all the library stuff. It is a valuable code container with so many examples of use of the library, the classes, the methods and the functions it defines.

The code has been developed using VS2022 IDE. As such, unitary tests have been coded using Microsoft Visual Studio Cpp Unit Test Framework. The related VS project is provided with this library.

Notice: no clang, gcc or msvc specific declarations or goodies have been use to code library **cpp-strings**. It should then be compilable with any of these compilers. To be able to use it with your project, just ensure that the c++ standard used with you favorite compiler is **c++20**:
* options `-std=c++20` or `-std=c++latest` for clang and gcc (v. 10 and above),
or option `-std=c++2a` for clang and gcc (v. 9 and earlier);
* options `/std=c++20` or `/std=c++latest` for Visual Studio 2019 and later.

If you want to run the unitary tests, well, use the last version of Visual Studio (i.e. VS 2022, by July 2025). The Community free version will truly be fine.
The vcproject associated with the unit tests in **cpp-strings** is already configured to use the option flag `/std:c++latest` since the implemented code uses a very few but very useful c++23 goodies.


---
## License

Library cpp-strings
"What if c++ strings where as easy to use as Python strings?"

Copyright (C) 2023-2025 Philippe Schmouker
contact - ph (dot) schmouker (at) gmail (dot) com

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.


---
## Intro
The creation of this library has been started with the aim at easing the use of strings in c++. Other projects exist, even aiming also to implement a Python-like strings API, but the only ones we have found were either started but not completed, or were not implementing the whole Python API.

So, we started to work on **Pythonic c++ strings**. Library **cpp-strings** is now ready. It fully implements the Python API (even with a c++ implementation of *slices*) and it is fully tested with *unitary tests*.

The implementation of library **cpp-strings** is fully templated and is contained into a single header file: `cpp-strings/cppstrings.h`. To take a whole benefit of it, just add this header file to your project and include it in your own files. It very fastly compiles. That's all!

Header file `cpp-strings/cppstrings.h` defines:
* templated class `template<typename CharT> class pcs::CppStringT` which implements all the stuff about pythonic c++ strings. It inherits from c++ STL class `std::basic_string<CharT>`, so it gets access to all c++ STL methods, functions and goodies about strings;
* this class is specialized by: `using pcs::CppString> = pcs::CppStringT<char>` for pythonic c++ strings based on `char` characters;
* it is also specialized by: `using pcs::CppWString> = pcs::CppStringT<wchar_t>` for pythonic c++ strings based on `wchar_t` characters.

The unitary tests are provided in directory `cpp-strings-tests/`. File `cpp-strings-tests/cpp-strings-tests.cpp` contains the related code. Tests have been coded using VS2022 IDE and as such, are using the Microsoft Visual Studio Cpp Unit Test Framework. The related VS project can be found in the same directory. It is already configured to create code for Release as well as for Debug configurations, and for 32-bits or 64-bits platforms at your choice.
This `.cpp` file is a great place to see **cpp-strings** code in action. Each structure, class, method, litteral operator and function being unitary tested in here, you should find there many examples of its use for all **cpp-strings** stuff.


---
## Latest Release - Release 1.0 (1.0.0.224) 2025/07

The coding of this project started by March 2023 and had been put in standby mode for some months - no time to work on it. The very first release is now availble (since July 2025), as **Release 1.0**.

This release has been fully tested. Code coverage is 100%.

Release 1.0 implements all Python strings API but one feature (see below).

Python *slices* are implemented via c++ `operator()` as declared and defined in the templated class `pcs::CppStringT<>`. Python slices have next specific notation: `[start : stop : step]` and allow the running step by step through range [start, stop) (notice: stop is excluded from the range). Operator `(start, stop, step)` acts the same way while running through the content of pythonic c++ strings. A dedicated base class `Slice` is also provided and can be passed as argument to `operator()`. It is derived in many simpler slices classes, since Python slices may not define either `start`, `stop` or `step` which then get default values (resp. 0, *end-of-sequence*, and 1).


### Missing parts in Release 1.0
Python strings are based on Unicode chars. This is currently not the case for pythonic c++ strings in **cpp-strings**.
Unicode encoding allows for a specific comparison mode on strings, the **casefold** mode. There, Unicode chars are transformed into their lower equivalent char in a standardized manner which is more "agressive" than the simpler lowering method `lower()`. Comparing strings without taking into account the case of their chars is then performed in a far more accurate manner.
This feature is currently NOT implemented in library **cpp-strings**.

So up to now, if you want to compare pythonic c++ strings from **cpp-strings** on whatever the case is for each of their chars, compare them applying method `.lower()` to both strings. This will do the job for chars and for wchar_t also for a majority of languages (but might fail for very few signs of specific languages in this last case).

Notice: dealing with Unicode chars and implementing method `casefold()` as it is the case in Python is planned for a next release of library **cpp-strings**.
N.B. "*planned for a next release*" does not imply that a fixed date is planned either.


---
## Documentation

The **cpp-strings** HTML documentation is available here: [html/index.html](html/index.html).

It has then been produced with the great utility **doxygen** developed by Vicente Hernando (the doxygen Github repository can be accessed [here](https://github.com/doxygen/doxygen), and the utility can be downloaded from there: [https://www.doxygen.nl/download.html](https://www.doxygen.nl/download.html)).

This is a short documentation of the library. For some of its part it is a copy of the Python original documentation on strings. For its other part it documents the c++ implementation of **cpp-strings**.

And remember: to better understand how to use this pythonic c++ strings library, have a look also at [`cpp-strings-tests/cpp-strings-tests.cpp`](cpp-strings-tests/cpp-strings-tests.cpp) to see **cpp-strings** library code in action!
Loading

[8]ページ先頭

©2009-2025 Movatter.jp