我正在尝试创建一个格式化美国电话号码的功能 - 希望不会遍历每个数字.
全部通过10位数就可以了.但是,当传递超过10位数字时,我希望String.Format方法在右侧附加扩展数字.例如:
当结果中传入的14位数字应该是:(444)555-2222 x8888当结果中传递的12位数应该是:(444)555-2222 x88等.但是我当前尝试得到的是:传入12位数字返回此字符串'() - 949 x555444433'
这是我到目前为止所拥有的.
public static string _FormatPhone(object phonevalue)
{
Int64 phoneDigits;
if (Int64.TryParse(phonevalue.ToString(), out phoneDigits))
{
string cleanPhoneDigits = phoneDigits.ToString();
int digitCount = cleanPhoneDigits.Length;
if (digitCount == 10)
return String.Format("{0:(###) ###-####}", phoneDigits);
else if (digitCount > 10)
return String.Format("{0:(###) ###-#### x#########}", phoneDigits);
else
return cleanPhoneDigits;
}
return "Format Err#";
}
Run Code Online (Sandbox Code Playgroud)
提前致谢.
我正在尝试使用Visual Studio 2012 SharePoint 2013列表设计器来创建查找字段但它无法正常工作
使用设计器我创建了一个简单的列表(广告代理商),其中包含一个列(代理商名称),我想在第二个列表中显示为查阅列.
再次,使用设计器我创建了另一个列表并添加了一个Lookup列.然后使用属性窗格,我在"类型"下为查找列设置了以下属性.
列表:广告代理商
ShowField:代理商名称
我部署解决方案并将项目添加到广告代理商列表中.然后我将项目添加到其他列表,但查找广告代理商列不包含任何内容.
我希望有人可以发现我可能做错的事情这似乎是如此直截了当.
谢谢阅读
我正在寻找一种方法来迁移我的VM,所以我可以在我的Win8,支持Hyper-V的机器上本地运行它.这可能吗?如果是这样,有人可以指点我这样做的教程或参考吗?我的研究还没有找到一种直接的方法.
谢谢
我在非c:\驱动器上安装了Visual Studio 2015 Update 3,看起来Visual Studio的Azure工具不喜欢这样.当我尝试创建新的Cloud Azure资源组项目然后尝试添加资源时,我收到以下错误.
---------------------------
Microsoft Visual Studio
---------------------------
The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
---------------------------
OK
---------------------------
Run Code Online (Sandbox Code Playgroud)
我还注意到,当我查看资源模板JSON文件时,不会填充JSON Outline Window.
除了在c:\上安装VS之外,有什么办法可以调整一些东西来让Azure资源工具正常工作吗?
似乎Windows Azure Powershell控制台与ISE的配置不同.
例如,在打开控制台窗口后,以下cmdlet可以正常工作:Get-AzureVMImage
现在当我输入ISE打开ISE应用程序时,找不到相同的cmdlet.
Get-AzureVMImage : The term 'Get-AzureVMImage' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
Run Code Online (Sandbox Code Playgroud)
我可以看到控制台窗口包含以下模块:
ModuleType Name ExportedCommands
---------- ---- ----------------
Binary Azure {Add-AzureAccount, Add-AzureCacheWorkerRole, Add-AzureCertificate, Ad...
Manifest Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-Authe...
Manifest Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Run Code Online (Sandbox Code Playgroud)
ISE显示缺少Azure模块.
ModuleType Name …Run Code Online (Sandbox Code Playgroud) 在创建或编辑keybindings.json文件时,Visual Studio Code v1.2.1不仅需要绑定键,还需要"CommandID"和"When"条件.
我正在寻找可供使用的"CommandID"的完整列表,但一直无法找到.完整的命令列表在哪里?
谢谢
我试图在内部ForEach循环中使用在外部ForEach循环中创建的变量.该值不会像我预期的那样通过,并且始终为null.
注意$ server的值总是为null你能告诉我为什么以及如何修复?
$Srvrs = "SVR1";
$Srvrs | ForEach-Object {
$server = $_;
Write-Host "Server value in outer Foreach:" $server;
$sourceFilesLoc = "D:\Test\SetupSoftwareAndFiles"
$sourceFiles = Get-ChildItem -LiteralPath $sourceFilesLoc;
$sourceFiles | ForEach-Object {
Start-Job -InputObject $server -ScriptBlock {
Write-Host "Server value in inner Foreach:" $server;
}
}
}
Run Code Online (Sandbox Code Playgroud) 自从我使用MS Access已经很长时间了,我不确定我是否正确这样做.
我有一个报告绑定到单个用户名列表的查询.报告对用户名进行分组,并在详细信息中包含子报告,即图表.
子报告/图表基于接受用户名参数的查询.由于子报告未绑定,我需要将用户名参数从主报告详细信息onload事件向下传递到子报告,从而传递到基础查询.
我不知道如何实现这一点,或者即使我的方法是合理的.
(ps我最初发布在"超级用户"上,但看到没有多少人使用该网站.)
谢谢您的帮助
我试图导出CSV集合哈希表项的名称/值对.我还没有找到代码的select-object部分的正确语法.我希望CSV文件为Url和所有者提供columes.谢谢您的帮助
[System.Collections.ArrayList]$collection = New-Object System.Collections.ArrayList($null)
$SiteInfo = @{};
$SiteInfo.Url = "http://some.url.com";
$SiteInfo.Owner = "Joe Smith";
$collection.Add($SiteInfo);
$SiteInfo.Url = "http://another.url.com";
$SiteInfo.Owner = "Sally Jones";
$collection.Add($SiteInfo);
$collection | foreach{
$hashTableDate = $_;
$hashTableDate | Select-Object -Property Url, Owner;
}| Export-Csv "C:\UsageReport.csv" -NoTypeInformation -Encoding UTF8 -Delimiter '|'
# results: file is empty :(
Run Code Online (Sandbox Code Playgroud) 我正在 VSCode 中寻找可为我添加文件夹书签的扩展或功能。我有许多文件夹需要不断处理,并且想快速打开它们。在 VSCode 的另一个实例中打开文件夹的选项将是最佳选择。
azure ×3
powershell ×2
access-vba ×1
c# ×1
hyper-v ×1
list ×1
lookup ×1
ms-access ×1
string ×1