-
Notifications
You must be signed in to change notification settings - Fork 1
/
localization.cpp
42 lines (38 loc) · 1.02 KB
/
localization.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <QDebug>
#include "localization.hpp"
using namespace SMSDB;
void Localization::FormatNumsToPersian(const QString &str, QString &out_str)
{
out_str.clear();
for (const auto &c : str) {
if (c == '0') {
out_str += "\u06F0";
} else if (c == '1') {
out_str += "\u06F1";
} else if (c == '2') {
out_str += "\u06F2";
} else if (c == '3') {
out_str += "\u06F3";
} else if (c == '4') {
out_str += "\u06F4";
} else if (c == '5') {
out_str += "\u06F5";
} else if (c == '6') {
out_str += "\u06F6";
} else if (c == '7') {
out_str += "\u06F7";
} else if (c == '8') {
out_str += "\u06F8";
} else if (c == '9') {
out_str += "\u06F9";
} else {
out_str += c;
}
}
}
QString Localization::FormatNumsToPersian(const QString &str)
{
QString result;
FormatNumsToPersian(str, result);
return result;
}