Jpp
examples
JLang
JString.cc
Go to the documentation of this file.
1
2
#include <string>
3
#include <iostream>
4
#include <fstream>
5
#include <locale>
6
#include <iomanip>
7
8
#include "
JLang/JString.hh
"
9
10
#include "
Jeep/JParser.hh
"
11
#include "
Jeep/JMessage.hh
"
12
13
14
/**
15
* \file
16
*
17
* Example program to test JLANG::JString class.
18
* \author mdejong
19
*/
20
int
main
(
int
argc,
char
**argv)
21
{
22
using namespace
std
;
23
24
int
debug
;
25
26
try
{
27
28
JParser<>
zap(
"Example program to test string operations."
);
29
30
zap[
'd'
] =
make_field
(
debug
) = 0;
31
32
zap(argc, argv);
33
}
34
catch
(
const
exception &error) {
35
FATAL
(error.what() << endl);
36
}
37
38
39
using namespace
JPP
;
40
41
cout << JString(
"%s = %d;"
,
"key"
, 123) << endl;
42
cout << JString(
"hello world."
).toUpper() << endl;
43
44
{
45
JString buffer(
"a = %1; b = %2; c = %3;"
);
46
47
cout << buffer.replace(
"%1"
, 3.1415).replace(
"%2"
,
"hello"
).replace(
"%3"
, 123) << endl;
48
}
49
50
51
{
52
int
i = JString::toValue<int>(
"1234"
);
53
54
cout << i << endl;
55
}
56
57
{
58
JString buffer(
"1 3.1415 hello"
);
59
60
int
i;
61
double
d;
62
string
w
;
63
64
buffer.assign(i).assign(d).assign(
w
);
65
66
cout << i <<
' '
<< d <<
' '
<<
w
<< endl;
67
}
68
}
JTOOLS::w
data_type w[N+1][M+1]
Definition:
JPolint.hh:708
JMessage.hh
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1493
JString.hh
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition:
JAAnetToolkit.hh:37
debug
int debug
debug level
Definition:
JSirene.cc:59
JParser.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1954
std
Definition:
jaanetDictionary.h:36
main
int main(int argc, char **argv)
Definition:
JString.cc:20
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
Generated by
1.8.16