📄 formalprocessor.h
字号:
/**
* FormalProcessor - Capitalises first character of each word
*
* @author Jonathan Roewen
*/
#ifndef FORMAL_PROCESSOR_H
#define FORMAL_PROCESSOR_H
#include "AimlProcessor.h"
#include "StringTokenizer.h"
#include "Kernel.h"
#include <string>
#include <cctype>
using namespace std;
class FormalProcessor : public AimlProcessor
{
public:
~FormalProcessor() { }
string getName() const {
return "formal";
}
string getVersion() const {
return "1.0";
}
string process(Match *m, PElement e, Responder *r, const string &id) {
string formal = Kernel::process(m, e, r, id);
StringTokenizer st(formal, " \n\r\t", true);
string result = "";
while (st.hasMoreTokens()) {
string word = st.nextToken();
word[0] = toupper(word[0]);
result += word;
}
return result;
}
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -