我试图让Palindrome程序尽可能小.但是,该程序给出了逻辑错误.当我输入回文字符串时,它会给出"假",这与预期相反.
char[] phrase;
Console.WriteLine((phrase = Console.ReadLine().ToArray())==phrase.Reverse().ToArray());
Console.ReadLine();
Run Code Online (Sandbox Code Playgroud)
我不想增加这个程序的语句数量.
在构建应用程序时,我收到以下错误:
Error:org.xml.sax.SAXParseException; lineNumber: 0; columnNumber: 0;
cvc-pattern-valid: Value 'build-tools;23.0.0 rc3'
is not facet-valid with respect to pattern '[a-zA-Z0-9_\-;.]+' for type 'segmentListType'.
Run Code Online (Sandbox Code Playgroud)
build.gradle模块级gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "ms.demo.map"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services-maps:8.4.0'
}
Run Code Online (Sandbox Code Playgroud)
清理应用程序后,错误仍然存在.包的结构与applicationIdgradle文件中描述的不匹配.我正在使用最新版本的Android Studio(2.0预览版9).
我的代码在这里:
string[] Lines = File.ReadAllLines(textBox1.Text);
List<string> NewLines = new List<string>();
foreach (string Line in Lines)
{
string newLine = Line.Trim();
if (!NewLines.Exists(newLine))
NewLines.Add(newLine);
Run Code Online (Sandbox Code Playgroud)
NewLines.Exists() 函数发出此错误:
最好的重载方法匹配System.Collections.Generic.List<string>.Exists(System.Predicate<string>)有一些无效的参数