相关疑难解决方法(0)

正则表达式 - 不包含某些字符

如果句子中的任何地方都没有<或>,我需要一个正则表达式来匹配.

如果<或>中的任何一个都在字符串中,那么它必须返回false.

我在这方面取得了部分成功,但前提是我的<>在开头或结尾:

(?!<|>).*$
Run Code Online (Sandbox Code Playgroud)

如果这有所不同,我正在使用.Net.

谢谢您的帮助.

添加问题:

我想知道,如果文本包含像这样的标签,你如何修改下面的正则表达式只返回false __CODE__

regex regex-negation

233
推荐指数
2
解决办法
36万
查看次数

Android写入日志文本文件

我正在尝试使用Mine的代码将日志写入Android文件上的自定义Log.txt文件,但此方法创建文件但不包含任何内容.基本上我想读取文件的先前内容,然后用现有内容附加我的数据.

守则如下:

public static void write(String str) 
    {
        InputStream fileInputStream = null;
        FileOutputStream fileOutpurStream = null;
        try
        { 
            fileInputStream = new FileInputStream(file);
            fileOutpurStream = new FileOutputStream(file);
            if(file.exists())
            {
                int ch = 0;
                int current = 0;
                StringBuffer buffer = new StringBuffer();
                while((ch = fileInputStream.read()) != -1)
                {
                    buffer.append((char) ch);
                    current++;
                }
                byte data[]=new byte[(int)file.length()];
                fileInputStream.read(data);   
                fileOutpurStream.write(data);
                fileOutpurStream.write(str.getBytes(),0,str.getBytes().length);
                fileOutpurStream.flush();
            } 
            else
            {   
                file.createNewFile();
                fileOutpurStream.write(str.getBytes(),0,str.getBytes().length);
                fileOutpurStream.flush();
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        finally
        {
            try
            {
                fileInputStream.close();
                fileOutpurStream.flush();
                fileOutpurStream.close();
                fileOutpurStream = …
Run Code Online (Sandbox Code Playgroud)

android

119
推荐指数
9
解决办法
18万
查看次数

如何在Android Studio中过滤logcat?

在我的logcat中输出太多,所以我想用一些关键字过滤它,基本上只显示包含关键字的输出.有没有办法通过UI在Android Studio中执行此操作?

logcat android-studio

91
推荐指数
8
解决办法
8万
查看次数

标签 统计

android ×1

android-studio ×1

logcat ×1

regex ×1

regex-negation ×1