本文介绍了如何删除编号之间的连字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI我有一个付款表格,在其中我从网关捕获一个交易ID.
就像1234586475-58445-7445.我想删除该字符串中的连字符,然后将其转换为整数.有人可以帮我吗.

HII have a payment form where I am catching one transaction id from gateway.
Its like 1234586475-58445-7445.I want to remove that hyphen in that string and then convert it into integer.Can anyone help me out.

推荐答案

string str="1234586475-58445-7445";
int64 num=Convert.ToInt64(str.Replace("-","");


string s = "1234586475-58445-7445";
s = s.Replace("-","");
double d = Convert.ToDouble(s);


string s = "1234586475-58445-7445";
s = s.Replace("-", "");
long l = long.Parse(s);


但是您不能在int中使用该数字-太大了! (一个int的最大值是31位:2147483647)


But you can''t fit that number in an int - it''s way too big! (maximum value in an int is 31 bits: 2147483647)


这篇关于如何删除编号之间的连字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 04:31