是否可以使用scanf()读取文本行 - 排除\n和中断特殊(选定)字符,但包含该字符
这是我目前的表达方式:while(scanf("%49[^:\n]%*c", x)==1)
但这个排除了:.是否有可能打破阅读:但也读这个角色?
是否可以以某种方式使用此类(test.Value 不是我正在寻找的):
RefBool test = false;
if (test)
{
}
Run Code Online (Sandbox Code Playgroud)
这是类主体:
public class RefBool
{
public bool Value { get; set; }
public RefBool(bool value)
{
this.Value = value;
}
public static implicit operator RefBool(bool val)
{
return new RefBool(val);
}
}
Run Code Online (Sandbox Code Playgroud) 我有计算Levenshtein距离的方法
public static LevenshteinMatches LevenshteinSingleThread(this string str, string expression, int maxDistance) {
if (str.Length > expression.Length + 1) {
int len = expression.Length;
long strLen = str.Length - len + 1;
int[] results = new int[strLen];
int[][,] dimension = new int[strLen][,];
for (int i = 0; i < strLen; i++) {
dimension[i] = new int[len + 1, len + 1];
}
string source = str;
source = source.ToUpper();
expression = expression.ToUpper();
for (int i = 0; i < strLen; i++) …Run Code Online (Sandbox Code Playgroud)