Jpp
Functions
JString.cc File Reference
#include <string>
#include <iostream>
#include <fstream>
#include <locale>
#include <iomanip>
#include "JLang/JString.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test JLANG::JString class.

Author
mdejong

Definition in file JString.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 20 of file JString.cc.

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
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
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
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
std
Definition: jaanetDictionary.h:36
FATAL
#define FATAL(A)
Definition: JMessage.hh:67