如何删除编号之间的连字符 [英] How to remove hyphen between nos

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

问题描述

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

HI I 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("-","");


您选择的数字太大.也许加倍可以帮助您.

The number you have chosen is too large. Perhaps a double would help you out.

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)


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

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