Forum > Random
[C++] Letters
(1/1)
Yolo33:
ww3
bizzlesnaff:
--- Quote from: "Yolo33" ---Hi, does someone know a script for Autohotkey or could make me a program that auto capitalizes only the first letter of a sentence? I would really appreciate it. --- End quote ---
A program? Most of the free editor do this...or..did I missed the topic ;)?
schlumpf:
--- Code: ---std::string input; bool new_sentence (true); for (std::string::iterator it (input.begin()); it != input.end(); ++it) { if (new_sentence && std::isalpha (*it)) { *it = std::toupper (*it); new_sentence = false; } else if (*it == '.') // possibly more sentence separators { new_sentence = true; } } --- End code ---
Untested, unclear definition of "new sentence", not entirely sure, but probably a acceptable start.
Krang Stonehoof:
If you're working in CodeBlocks you can do that:
--- Code: ---#include <iostream> #include <ctype.h>
using namespace std;
int main() { char c[] = "your sentence."; c[0] = toupper(c[0]); cout << c; return 0; }
--- End code ---
That's what we are learning in my country in high school.
Yolo33:
be possible?
Navigation
[0] Message Index
|