小编Ana*_*and的帖子

如何在matplotlib表中设置列的背景颜色

我在目录中有多个.txt文件,比如d:\ memdump\0.txt,1.txt,... 10.txt示例文本文件如下:

 Applications Memory Usage (kB):
 Uptime: 7857410 Realtime: 7857410
** MEMINFO in pid 23875 [com.example.twolibs] **
                 Shared  Private     Heap     Heap     Heap
               Pss    Dirty     Dirty     Size    Alloc     Free
              ------   ------   ------   ------   ------   ------
  Native        0        0        0       13504    10836      459
  Dalvik     6806     7740     6580       24076    18523     5553
  Stack       80        0       80                           
  Cursor        0        0        0                           
  Ashmem        0        0        0                           
  Other dev    14741      836     1028                           
 .so mmap     1367      448     1028                           
 .jar mmap        0        0        0                           
 .apk mmap      225        0 …
Run Code Online (Sandbox Code Playgroud)

python matplotlib

5
推荐指数
1
解决办法
5790
查看次数

删除java源代码中的注释

我想从 java 源代码文件中删除所有类型的注释语句。例子:

    String str1 = "SUM 10"      /*This is a Comments */ ;   
    String str2 = "SUM 10";     //This is a Comments"  
    String str3 = "http://google.com";   /*This is a Comments*/
    String str4 = "('file:///xghsghsh.html/')";  //Comments
    String str5 = "{\"temperature\": {\"type\"}}";  //comments
Run Code Online (Sandbox Code Playgroud)

预期输出:

    String str1 = "SUM 10"; 
    String str2 = "SUM 10";  
    String str3 = "http://google.com";
    String str4 = "('file:///xghsghsh.html/')";
    String str5 = "{\"temperature\": {\"type\"}}";
Run Code Online (Sandbox Code Playgroud)

我使用下面的正则表达式来实现:

    System.out.println(str1.replaceAll("[^:]//.*|/\\\\*((?!=*/)(?s:.))+\\\\*/", ""));
Run Code Online (Sandbox Code Playgroud)

这给了我 str4 和 str5 错误的结果。请帮我解决这个问题。

使用 Andreas 解决方案:

        final String regex …
Run Code Online (Sandbox Code Playgroud)

java regex

2
推荐指数
1
解决办法
1175
查看次数

标签 统计

java ×1

matplotlib ×1

python ×1

regex ×1