当我点击“查找所有引用”时,它会尝试查找工作区内文件中的所有引用。
我只想在 vs code 中搜索“查找所有引用”功能时才使用当前文件。
我只想搜索当前正在编辑文件的黄色标记文件中的引用,并且不想搜索文件所有其他文件,例如紫色 X 标记区域。
我需要计算字符串中的前导零。
这就是我发现的整数前导零数
static int LeadingZeros(int value)
{
// Shift right unsigned to work with both positive and negative values
var uValue = (uint) value;
int leadingZeros = 0;
while(uValue != 0)
{
uValue = uValue >> 1;
leadingZeros++;
}
return (32 - leadingZeros);
}
Run Code Online (Sandbox Code Playgroud)
但找不到计算字符串中的前导零。
string xx = "000123";
Run Code Online (Sandbox Code Playgroud)
上面的例子有 000 所以我想得到结果计数为 3
我如何计算字符串中的零?
如果有人给我小费,非常感谢