电话号码格式问题

编程入门 行业动态 更新时间:2024-10-26 01:17:25
本文介绍了电话号码格式问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

尝试使用以下方法将格式传递给我的电话号码,但不起作用 谁能解释 我的错误是 字符串"不包含子字符串"的定义,并且找不到找到接受字符串"类型的第一个参数的扩展方法子字符串"(您是否缺少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帮助页面并查看正确的拼写是否如此困难?好吧,现在看看: msdn.microsoft/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: msdn.microsoft/en-us/library/system.string.substring.aspx[^]. Please, no offense: what you really need to learn is this: Microsoft Q209354.
—SA

更多推荐

电话号码格式问题

本文发布于:2023-10-27 22:39:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1534763.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:电话号码   格式

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!