c# List<int> 转 string 以及 string [] 转 List<int>
List<int> 转 string :
list<int>: 1,2,3,4,5,6,7 转换成字符串:“1,2,3,4,5,6,7”
List<int> list= new List<int>() { 1, 2, 3, 4, 5, 6, 7 };
string depaid = string.Join(",", list);
string 转 List<int>:
string s = "1, 2, 3";
List<string> list = new List<string>(s.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries));
List<string> list = new List<string>(s.Split(','));//或者
List<string> 转 List<int>
var listOfStrings =(new[]{"4","5","6"}).ToList();
var listOfInts = listOfStrings.Select<string,int>(q =>Convert.ToInt32(q));
List<int> 转List<string>
List<int> l1 = new List<int>(new int[] { 1,2,3 } );
List<string> l2 = l1.ConvertAll<string>(x => x.ToString());
C#中string[]数组和list<string>:
System.String[] str={"str","string","abc"};
List<System.String> listS=new List<System.String>(str);
从List<System.String>转到System.String[]
List<System.String> listS=new List<System.String>();
listS.Add("str");
listS.Add("hello");
System.String[] str=listS.ToArray();
c# List<int> 转 string 以及 string [] 转 List<int>的更多相关文章
- C#学习笔记-输入数据判断(int、double、string)
代码: using System; using System.Windows.Forms; namespace CheckInput { public partial class Form1 : Fo ...
- C#,int转成string,string转成int
转载:http://www.cnblogs.com/xshy3412/archive/2007/08/29/874362.html 1,int转成string用toString 或者Convert.t ...
- [C#]List<int>转string[],string[]转为string
// List<int>转string[] public string[] ListInt2StringArray(List<int> input) { return Arra ...
- 【java基础学习一】int[]、Integer[]、String[] 排序( 正序、倒叙)、去重
调用: //重复项有9.5.1.2 int[] ints = new int[]{9,4,7,8,2,5,1,6,2,5,9,1}; arrayIntTest(ints); ///////////// ...
- C++ 中int,char,string,CString类型转换
1. c++中string到int的转换 1) 在C标准库里面,使用atoi: #include <cstdlib> #include <string> std::stri ...
- 首先,定义描述学生的类——Student,包括学号(int)、 姓名(String)、年龄(int)等属性;二个方法:Student(int stuNo,String name,int age) 用于对对象的初始化,outPut()用于输出学生信息。其次,再定义一个主类—— TestClass,在主类的main方法中创建多个Student类的对象,使用这些对象来测 试Student类的功能。
package lianxi; public class Student { String Name; int XveHao,Age; Student(String Name,int XveHao,i ...
- C字符串和C++中string的区别 &&&&C++中int型与string型互相转换
在C++中则把字符串封装成了一种数据类型string,可以直接声明变量并进行赋值等字符串操作.以下是C字符串和C++中string的区别: C字符串 string对象(C++) 所需的头文件名称 ...
- C++11中int,float,double与string的转化
在C++11中可以使用std::to_string()函数将数值转换为string格式,十分方便. 以下部分来选自cplusplus.com. std::to_string string to_str ...
- 【转】java中byte, int的转换, byte String转换
原文网址:http://freewind886.blog.163.com/blog/static/661924642011810236100/ 最近在做些与编解码相关的事情,又遇到了byte和int的 ...
随机推荐
- 国内一些SCM相关论坛站点
SCMROAD: http://www.scmroad.com/forum.php SCMEYE:http://www.scmeye.com/ SVN管家:http://www.svnclub.com ...
- Scrum敏捷开发简介
Agile 敏捷开发实践中,强调团队的自我管理.在 Scrum 中,自我团队管理体现在每天的 Scrum 会议中和日常的协同工作,在每天的 Scrum 例会中,团队成员一般回答一下几个问题 : 昨天完 ...
- HDOJ-1999 不可摸数
不可摸数 转自:http://www.cnblogs.com/dongsheng/archive/2012/08/18/2645594.html Time Limit: 2000/1000 MS (J ...
- HDU 1753 大明A+B(字符串模拟,简单题)
简单题,但要考虑一些细节: 前导0不要,后导0不要,小数长度不一样时,有进位时,逆置处理输出 然后处理起来就比较麻烦了. 题目链接 我的代码纯模拟,把小数点前后分开来处理,写的很繁杂,纯当纪念——可怜 ...
- hdu 1005 Number Sequence(矩阵快速幂,找规律,模版更通用)
题目 第一次做是看了大牛的找规律结果,如下: //显然我看了答案,循环节点是48,但是为什么是48,据说是高手打表出来的 #include<stdio.h> int main() { ], ...
- hdu 2717 Catch That Cow(BFS,剪枝)
题目 #include<stdio.h> #include<string.h> #include<queue> #include<algorithm> ...
- VS2010彻底卸载
下载Microsoft Visual Studio 2010 Uninstall Utility来移除,默认情况下,这将删除 Visual Studio 和支持组件,但不会删除与计算机上的其他应用程序 ...
- Bash 小知识点
变量定义的时候=两边不能有空格,例如: a='Hello World' 如果变量和其它字符相连,可以用{}把变量引起来,这样就可以和相连的字符隔离 除了在变量赋值和在FOR循环语句头中,BASH中的变 ...
- 原版win7镜像IE主页被篡改?
装了几次系统,镜像是从“MSDN我告诉你”上下载的,但是每次装完,发现IE主页不是microsoft的官方网页,而是www.3456.com. 这就奇了怪了,难道“MSDN我告诉你”提供的不是原版镜像 ...
- 2410中断中SRCPND和INTPND清零的疑问
2410中断中SRCPND和INTPND清零的疑问SRCPND是中断源引脚寄存器,某个位被置1表示相应的中断被触发,但我们知道在同一时刻内系统可以触发若干个中断,只要中断被触发了,SRCPND的相应位 ...