我有一个Tab-delimited字符串(表示一个表),传递给我的方法.当我将它打印到命令行时,它看起来像一个包含行的表:
http://i.stack.imgur.com/2fAyq.gif
命令窗口已正确缓冲.我的想法是每行之前或之后肯定有一个新的行字符.
我的问题是我想将传入的字符串拆分为表示表格行的单个字符串.到目前为止,我有:
private static final String newLine = System.getProperty("line.separator").toString();
private static final String tab = "\t";
private static String[] rows;
...
rows = tabDelimitedTable.split(newLine); //problem is here
System.out.println();
System.out.println("################### start debug ####################");
System.out.println((tabDelimitedTable.contains(newLine)) ? "True" : "False");
System.out.println("#################### end debug###################");
System.out.println();
Run Code Online (Sandbox Code Playgroud)
输出:
################### start debug ####################
False
#################### end debug###################
Run Code Online (Sandbox Code Playgroud)
显然,字符串中有一些东西告诉操作系统开始新的一行.然而它显然不包含换行符.
在Windows XP SP3上运行最新的JDK.
有任何想法吗?
我有 Mac OS X Mountain Lion。我使用终端进行编程来运行我的编译器。我还打开了取景器窗口以便快速访问。我启用了“文件夹中的新终端”服务,因此当我右键单击目录并选择此选项时,它会打开一个新的终端窗口。问题是它不会使用我的默认设置打开窗口(我将终端默认设置为专业设置)。有没有办法改变它,以便它使用我的默认终端设置?
谢谢!
当我编译以下c ++代码时:
#include "ConstantList.h"
using namespace std;
int main() {
ConstantList* cl = new ConstantList();
//do something with cl
delete cl;
cl = NULL;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
编译器给我错误:
Undefined symbols:
"ConstantList::~ConstantList()", referenced from:
_main in ccNfeeDU.o
"ConstantList::ConstantList()", referenced from:
_main in ccNfeeDU.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
我没有获得实例化对象的语法吗?我的ConstantList.h文件如下所示:
#ifndef ConstantList_h
#define ConstantList_h
#include <string>
#include "Token.h"
using namespace std;
class ConstantListTail;
class ConstantList {
public:
ConstantList();
~ConstantList();
std::string toString();
void push_back(Token*);
void push_back(ConstantListTail*);
private:
Token* …Run Code Online (Sandbox Code Playgroud) 假设我有一个类似于以下的数据库:
表student_info:
id name
111 jon
112 dan
113 david
...
Run Code Online (Sandbox Code Playgroud)
和表分数:
item_id student_id score
01 111 37
02 111 45
01 112 55
02 112 44
01 113 66
02 113 45
...
Run Code Online (Sandbox Code Playgroud)
是否可以执行mysql查询来生成下表?:
Student_Name ITEM_1_SCORE ITEM_2_SCORE
jon 37 45
dan 55 44
david 66 45
...
Run Code Online (Sandbox Code Playgroud)
如果是这样,语法是什么?我不知道这是一个连接操作还是其他什么?
谢谢.