从网上copy了一些文本,出现了很多空行,脚本作用就是把空行去掉,代码如下writer =newFileWriter("output.txt")newFile("Hello.txt").eachLine { line ->if(line !='') { writer.write((newString(line.getBytes("GBK")))+'r\n') }}writer.close()脚本很简单,不过刚开始没考虑中文编码问题,结果出现了乱码。Google了一下 groovy中文乱码,不过没找到相关问题,再Google java中文乱码,结果用java的解 ...
1、注释。Groovy有四种类型的注释#! 型注释:这种注释只能出现在脚本文件的第一行,用来提示语言解释器的位置,例如#!/usr/bin/groovy单行注释 ,以 // 开头多行注释,包含在 /*    */ 之间类似javadoc的注释  /**   */2、标准输出、输入输出到控制台:def age =25print"Myageis:"println ageprintln"Myageis:${age}"从键盘输入print"Pleaseenteryourname:"name =newInputStreamReader(System.in).readLine()println"Mynam ...
boolean
1、Java 正则表达式中的Quantifiers(量词)使用来指定匹配字符出现的次数的,java api中有三种Quantifiers: greedy, reluctant, and possessive。虽然三种quantifiers的作用很相似(见下表),但是三者还是有区别的。(摘自java.sun.com)Quantifiers Meaning  Greedy  Reluctant  Possessive  X?  X??  X?+  X, once or not at all  X*  X*?  X*+ ...
  • 22:35
  • 浏览 (33)
  • 评论 (0)
1、Java 1.4之后的版本引进了一个用于处理正则表达式的包 java.util.regex.*; 该包主要包含三个类:Pattern : 用来表示一个经过编译处理后的正则表达式。通俗一点来说,就是用一个类来表示一个正则表达式,这个类是从正则表达式构造得到的。这个类并没有public constructor, 如果想得到一个这个类的一个对象则必须调用该类的public static方法:public static Pattern compile(String regex)或者 public static Pattern compile(String regex,int flags)。这两个方 ...
1、默认构造函数和析构函数:没有参数的构造函数称为默认构造函数,你自己可以创建默认构造函数,也可以让编译器提供一个默认构造函数当且仅当你没有定义构造函数时编译器才会提供默认构造函数编译器提供的默认构造函数什么也不做2、析构函数永远不能有参数
最近做的东西都要用vc,很多错误都莫名, sigh。。。 Java真好!1、error C2146: syntax error : missing ';' before identifier 'ContextRecord'c:\program files\psdk\include\winnt.h(3393) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intc:\program files\psdk\include\winnt.h(3393) : error C4 ...
The data types supported by Microsoft® Windows® are used to define function return values, function and message parameters, and structure members. They define the size and meaning of these elements. The following table contains the following types: character, integer, Bool ...
因网络课程的作业需要用到winpcap,不得已又要和C++打交道了。由于winpcap是为vc而设计的,但是我又不大喜欢用盗版,于是打算用免费的 VC++ 2005 Express版。1、安装 Visual Studio 2005 Express Edition 和 Paltform SDK。如何安装Visual Studio 2005 Express在这里就不赘述了,很简单的。由于VC Express没有自带 Platform SDK,所以需要自己下载安装(如果不安装 psdk的话,就会出现 找不到 winsock2.h 的编译错误)。由于微软现在官网提供的psdk下载比较麻烦,需要wind ...
1、备份整个数据库(估计也是最土的方法了)mysqldump --user=user --host=host --port=port --password=password dbname > filename.sql如果没有指定 host和port参数,则客户端会连向localhost的mysql server。如果要备份多个数据库,则可添加参数 --database, 例如 --databases db1 db2要备份数据库需要必要权限2、备份整个数据库相应的恢复方法:mysql --user=user --host=host --port=port --password=passwo ...