将所有手机号码中的+91设置为数组 [英] Set +91 in all Mobile Number in to the Array

查看:82
本文介绍了将所有手机号码中的+91设置为数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个手机号码数组,手机号码来自数据库.我制作了一个Web应用程序,并使用通过Way2sms向用户手机号码发送消息.但我想将每个移动电话前面都添加为+91,然后将移动电话号码添加到移动电话号码数组中..

例如如果将2个手机号码放入数组,则它将像
一样存储在数组中 + 911234567890,+ 911234569870.

因此可以像这样存储..
数据库中有1000个数据,无法手动编辑yy

请帮帮我..

在此先感谢....
Mitesh

Hello,

i have a mobile number array and mobile number come from database. i make a web application and use sending message to the user mobile number Via Way2sms. but i want to add each and every mobile ahead as +91 then mobile number into Mobile number array..

e.g. if 2 mobile number into array then it will be stored in array like
+911234567890,+911234569870.

so this will be achived to stored like this..
there is 1000 of data in database and not possible to edit manuallyyy

Please help me..

Thanks in advance....
Mitesh

推荐答案



使用LINQ Lambda非常简单,

这是代码,

Hi,

Its very simple using LINQ Lambda,

Here is the code,

string[] number = new string[] {"9898989","9565535"};
number = number.Select(s => string.Format("+91{0}", s)).ToArray<string>();



此代码有一个限制,您需要添加where子句以检查+91是否已添加?希望你能做那么小的事情:)

谢谢
-Amit Gajjar.



There is one limitation with this code, you need to add where clause to check if +91 is already added ? hope you can do that small stuff :)

Thanks
-Amit Gajjar.


这篇关于将所有手机号码中的+91设置为数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆