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的 ...
随机推荐
- tomcat 解析(一)-文件解析
做web项目,最常用的服务器就是Apache的tomcat.虽然一直在用tomcat,但都是仅限在使用的阶段,一直没有深入学习过.想深入学习tomcat,首推的肯定是官网:http://tomcat. ...
- pl/sql tutorial
http://plsql-tutorial.com/plsql-procedures.htm What is PL/SQL? PL/SQL stands for Procedural Language ...
- POJ 1862
#include <iostream> #include <algorithm> #include <iomanip> #include <cmath> ...
- POJ 1852
#include <iostream> using namespace std; int main() { //freopen("acm.acm","r&qu ...
- java数据结构学习(一)之二分查找
二分查找法与我们在孩童时期玩过的猜数的游戏一样,这个游戏里一个朋友会让你猜他正想的一个1至100的数,当你猜了一个数后,他会告诉你三种选择的一个:你猜的比她想的大,或小,或猜中了.为了能用最少的次 ...
- Ubuntu环境下手动配置HBase0.94.25
/×××××××××××××××××××××××××××××××××××××××××/ Author:xxx0624 HomePage:http://www.cnblogs.com/xxx0624/ ...
- Winform基础 -- 菜单
快速创建默认菜单 使用控件 MenuStrip : 点击菜单的右上方小三角:选择 [插入标准项] 即可显现出标准的菜单格式: 如果想添加更多的菜单项,可以在 [请在此处键入] 处输入菜单项的名称 ...
- Oracle 6 - 锁和闩 - 并发问题和隔离级别
并发带来的问题 1.脏读dirty read 脏读的问题是transaction读到了没有被提交的数据.例如,T1更新了data1,还没提交,这时T2读取了更新后的data1, 用于计算和更新别的值, ...
- 深入浅出Java并发包—指令重排序
前面大致提到了JDK中的一些个原子类,也提到原子类是并发的基础,更提到所谓的线程安全,其实这些类或者并发包中的这么一些类,都是为了保证系统在运行时是线程安全的,那到底怎么样才算是线程安全呢? Java ...
- [优先队列]HDOJ5360 Hiking
题意:有n个人,每个人有两个参数$l$和$r$ 邀请他们去hiking, 当 当前已经邀请到的人数大于等于$l$,并且小于等于$r$,那么这个人就会去 问最多能邀请到几个人 并输出 依次要邀请的人的 ...