电话号码格式问题 [英] phone number formatting issue
本文介绍了电话号码格式问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试使用以下方法将格式传递给我的电话号码,但不起作用
谁能解释
我的错误是
字符串"不包含子字符串"的定义,并且找不到找到接受字符串"类型的第一个参数的扩展方法子字符串"(您是否缺少using指令或程序集引用?)
模型
try to use the following method to pass the format to my phone number,butis not work
can anybody explain
the error i have is
''string'' does not contain a definition for ''substring'' and no extension method ''substring'' accepting a first argument of type ''string'' could be found (are you missing a using directive or an assembly reference?)
the model
public class ViewModel
{
private string formatPhoneNumber(string phone)
{
//should return (123)456-7890
return string.Format("({0})-{1}-{2}");
}
}
推荐答案
总体而言,您的工作方式根本是错误的.查看MSDN帮助页面并查看正确的拼写是否如此困难?好吧,现在看看:
http://msdn.microsoft.com/en-us/library/system.string. substring.aspx [ ^ ].
请不要冒犯:您真正需要学习的是: Microsoft Q209354 .
—SA
Something is fundamentally wrong with your approach to work in general. Was it so difficult to look at the MSDN help page and see the right spelling? Well, take a look now:
http://msdn.microsoft.com/en-us/library/system.string.substring.aspx[^].
Please, no offense: what you really need to learn is this: Microsoft Q209354.
—SA
这篇关于电话号码格式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文