我有两个带有以下选择语句的 sql 视图:
1.
select SUBSTRING(UpdatedColumn,3, 9) as [PartialSearch] from [Database_Name].[dbo].[Table]
Run Code Online (Sandbox Code Playgroud)
2.
select SUBSTRING(OldColumn,3, 9) as [PartialSearchOnLiveTable] from [Same_Database_Name].[dbo].[DifferentTable]
Run Code Online (Sandbox Code Playgroud)
这两个视图分别仅返回 1 列。现在我想将第一个视图中的值与第二个视图中的值进行比较,并返回未找到匹配项的 UpdatedColumn 数据。
我已经考虑过使用比较运算符,但似乎无法得到我想要的,因为根据我的逻辑,我必须在 where 子句中指定视图之间的条件检查,而 sql 不允许这样做。另外,UNION/UNION ALL 只会给出所有记录的结果集。这是我不想要的。
最后,我查看了合并两个选择语句进行日期比较,这不是我想要的。
实际上,视图 1 返回:
abcxxxxxx
dokjfhxxx
cmodxxxxx
wuysxxxxx
aaallooxx
Run Code Online (Sandbox Code Playgroud)
查看 2 个退货:
xdsffsafa
xxxxhjsks
ajdhxxxxx
cmodxxxxx
xxxxxx12s
skskshdki
aaallooxx
Run Code Online (Sandbox Code Playgroud)
从输出中我们看到有两个匹配项。那个
aaallooxx
cmodxxxxx
Run Code Online (Sandbox Code Playgroud)
这就是我正在寻找的输出。有什么建议么?
所以我有一个包含百分比符号的字符串%。我希望能够使用将其替换为#符号TypeScript。我还在学习TypeScript,所以它的语法仍然让我失望。我设法实现了我在C#中所需的解决方案,并且可以在下面找到该段代码:
public static void Main(string[] args)
{
string data = "AHu%odk"; //The % character will always be at index 3
string finalResult = "";
if (data.Contains("%"))
{
StringBuilder sbFirstIndex = new StringBuilder(data);
sbFirstIndex[3] = '#';
finalResult = sbFirstIndex.ToString();
Console.WriteLine("Appended string now looks like this: {0} \n", finalResult);
}
else
{
Console.WriteLine("False. It does not contain it");
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的TypeScript实现,但是如果检查字符的索引,就会卡住:
changePercantage(input: string): void {
var data= "AHu%odk";
var finalResult = "";
var index = result.indexOf("%"); …Run Code Online (Sandbox Code Playgroud) 我有两个if-else条件会在Windows Forms文本框中显示一些文本.此文本框具有从UI线程以外的其他线程设置的文本.
语境:
delegate void SetTextCallback(string text);
private void SetText(string text)
{
if (this.txtMessages.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(SetText);
this.Invoke(d, new object[] { text });
}
else
{
this.txtMessages.Text = text;
}
}
private void setTextFunc()
{
if(this condition is true)
{
setText("Hello from text 1" + Environment.NewLine);
}
else
{
setText("Hello from text 2" + Environment.NewLine);
}
}
Run Code Online (Sandbox Code Playgroud)
现在的问题是,当Hello from text 2文本显示时,它会覆盖第一个文本.我希望它在下面并保留第一个文本.我怎样才能做到这一点?
我考虑过使用列表集合:
List<string> listOfStrings = new List<string>();
listOfStrings.Add("Hello from text 1"); …Run Code Online (Sandbox Code Playgroud) I have the following string:
string testString = ",,,The,,,boy,,,kicked,,,the,,ball";
Run Code Online (Sandbox Code Playgroud)
I want to remove the unwanted commas and have the sentence as this (simply printed to the console):
The boy kicked the ball
Run Code Online (Sandbox Code Playgroud)
I tried the below code:
string testString = ",,,The,,,boy,,,kicked,,,the,,ball";
string manipulatedString = testString.Replace(",", " "); //line 2
Console.WriteLine(manipulatedString.Trim() + "\n");
string result = Regex.Replace(manipulatedString, " ", " ");
Console.WriteLine(result.TrimStart());
Run Code Online (Sandbox Code Playgroud)
However, I end up with a result with double whitespaces as so:
The boy kicked the ball
Run Code Online (Sandbox Code Playgroud)
It kind …