且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将字符串值转换为int

更新时间:2023-02-04 08:08:06

嗨Sanjay,



在ypur tabtaype中你有一个逗号分隔的字符串。因此,在拆分后,您将获得一个整数数组。例如:

  string  tabtype =  ,7,8,11; 
int [] nums = Array.ConvertAll(tabtype.Remove( 0 1 )。分割(' ,'), int .Parse);





您现在拥有一系列公司。循环使用这些ID。



希望这有帮助! :) :)







问候,

Praneet


  string  tabtype =   7,11\" 跨度>; 

string [] num = tabtype.Split(' ,跨度>);

int a = int .Parse(num [ 0 跨度>]);


i have two varible
string tabtype=,7,11;

int Company=tabtype;


how to convert string value to int

Hi Sanjay,

In ypur tabtaype you have a comma seperated string. So after splitting you will get an array of integers. Like:
string tabtype = ",7,8,11";
int[] nums = Array.ConvertAll(tabtype.Remove(0, 1).Split(','), int.Parse);



You now have an array of Company. Loop this and use these ids.

Hope this helps !! :) :)



Regards,
Praneet


string tabtype = "7,11";

string[] num = tabtype.Split(',');

int a = int.Parse(num[0]);