java log add function
#dd_traces.pl (C) Marko Kivij?rvi 2006
# Dummy checks
die "Specify an input file!\n" if $ARGV[0] eq "";
die "File not found!\n" unless -e $ARGV[0];
die "Incorrect file extension for a C/C++ file!\n"
if ( $ARGV[0] !~ /(.*)\.(java)$/ );
# Constants
my $IMPORT_LOG_PACKAG = "\nimport android.util.Log;";
my $TAG;
if( $ARGV[0] !~ /BaseAdapter\.java/ && $ARGV[0] !~ /View\.java/) {
$TAG="SWIFTTAG";
}
else {
$TAG="SWIFTBASETAG";
}
# Parse output filename from the input filename
my $file = $ARGV[0];
my $origFile = $1."-orig.".$2;
#system( "cp $file $origFile" );
# Reset the input record separator (newline) so the entire file is read at once
undef $/;
# Read the input file
$_ = <>; # All there
# Adds a tracer macro after each function definition
s/
package #package
\s+
[^{;\/(\s]*\.[^{;\/(\s]* # package name
;
/
AddLogImport(tiny_mce_markeramp;) # Print the match and add the macro
/gxe; # g = repeat, x = split regex to multiple lines, e = evaluate substitution
s/
(public|private|protected)? #api property type
(\s+)?
(abstract)?
(\s+)?
class # Possible function return type
\s+ # One or more empty spaces
(\b\w+?) &n
相关文档:
String str = "中";
String str1 = new String(str.getBytes("gbk"), "ISO8859-1");
String str2 = new String(str1.getBytes("ISO8859-1"), "gbk");
System.out.println(str2); //输出"中" ......
在目前的关于java自学的讨论中,最经常看到的就是钻研《Thinking in java》(TIJ)的经验,但是,尽管使用TIJ作为教学材料的教学行为也很多,我却尚未发现有从教师关于如何将TIJ用于教学的论述。为此,我权作抛砖引玉。
首先,为什么要学习java?按照Eckel的话说, ......
import java.io.*;
public class FileReaderSample {
public static void main(String args[]) throws IOException
{
// 建立可容纳1024个字符的数组
char data[]=new char[1024];
// 建立对象fr
FileReader fr= ......
import java.io.*;
public class FileWrite {
public static void main(String args[]) {
String outPut = "C:\\bin";
StringBuffer ab = new StringBuffer();
for(int i=6;i<=30;i++){
ab.append("http://www.test.com/joke/index_"+i+".htm\r\n&qu ......