New answers tagged strings
0
votes
C++ custom string class implementation
The interface of your class is fine: you are following the rule 5; that means you have the 5 big special functions:
Destructor
Copy constructor
Copy assignment operator
Move constructor
Move ...
1
vote
Accepted
Redouble each occurrence of char recursively, and add n
You can calculate the number of doublings instead of looking it up in a map. The code below is otherwise copied from @Roman's answer.
...
0
votes
Redouble each occurrence of char recursively, and add n
You can simplify the calculation of the number of doubling operations using a mathematical formula instead of the pre-calculated map.
...
1
vote
Concatenating optional strings in Scala
Options can be concatenated to get an Iterable, which then makes things easier...
...
1
vote
Redouble each occurrence of char recursively, and add n
Nested If-Statements
You can simplify the code and improve the readability as a result. It is achievable by using the Guard Pattern which in short can break off nested if-statements by inverting the ...
1
vote
Accepted
String represents a road. One character travels on the road obeying the stops - Code challenge (advent.js day 5)
carefully read the requirements
The original problem asks us to
Create a function that simulates the sled's movement ...
Somehow you leapt from that to
All must be in just one function.
I see no ...
2
votes
Convert camelCase and PascalCase to Title Case
Instead of writing and maintaining this function, one could use this publicly available package: to-case.
Sample usage:
...
3
votes
Accepted
Image file uploader webpage in HTML5 and PHP
Back end code
Add file type checking
As this comment on PHP.net mentions:
A note of security: Don't ever trust $_FILES["image"]["type"]. It takes whatever is sent from the browser,...
Top 50 recent answers are included
Related Tags
strings × 2917java × 635
python × 482
c++ × 397
c × 392
performance × 373
algorithm × 353
beginner × 321
c# × 319
javascript × 214
programming-challenge × 212
python-3.x × 135
parsing × 127
array × 124
regex × 124
interview-questions × 99
formatting × 95
php × 85
reinventing-the-wheel × 77
c++11 × 73
comparative-review × 65
file × 61
search × 61
ruby × 57
random × 55