当前位置:网站首页>Usage of C tryparse
Usage of C tryparse
2022-06-10 23:44:00 【Unity tool man】
// Return value :bool, Represents whether the conversion is successful
// Parameters :s The object being converted ,result The assigned object
public static bool TryParse(string s, out Int32 result);
call
int num;
Debug.log(int.TryParse("9527",out num));
The method TryParse similar Parse , But if the conversion fails , The method TryParse No exceptions . It doesn't need to use exception handling to test FormatException Invalid events that cannot be successfully parsed .
Allied API
int.Parse()
int.Parse() It's a kind of accommodation ; Represents the conversion of a numeric string to int type . If the string is empty , Throw out ArgumentNullException abnormal ; If the content of a string is not a number , Throw out FormatException abnormal ; If the number represented by the content of the string exceeds int The range that a type can represent , Throw out OverflowException abnormal ; int.TryParse And int.Parse It's similar to , But it doesn't produce anomalies , Conversion successful return true, Conversion failure returns false. The last parameter is the output value , If the conversion fails , The output value is 0
Official documents :https://docs.microsoft.com/zh-cn/dotnet/api/system.int32.tryparse?view=net-6.0#system-int32-tryparse(system-string-system[email protected])
边栏推荐
- Fiddler configuration
- Is it safe to open an account in Shanghai Stock Exchange?
- Data and information resource sharing platform (IV)
- Data and information resource sharing platform (6)
- Ma8601 pin √ pin replaces Tang Ming fe1.1s without changing the circuit board | perfectly replaces fe1.1s scheme
- LeetCode 501 :二叉搜索树中的众数
- easyrecovery15操作简单方便的数据恢复工具
- 上海股票开户是安全的吗?
- Is it safe to open an account for tongdaxin stock? How to open an account?
- Unity 脚本无法显示C#源码的中文注释 或者VS创建的脚本没有C#源码的注释
猜你喜欢

Project training 11 - regular backup of database

Leetcode 501: mode in binary search tree

leetcode 130. Surrounded regions (medium)

Sealem Finance - a new decentralized financial platform based on Web3

Project training 13 - Interface supplement
![[Interface tutorial] how does easycvr set platform cascading through the interface?](/img/d5/b7cbe9522e91a7ae29558bb2abe1fa.jpg)
[Interface tutorial] how does easycvr set platform cascading through the interface?

PHP implementation of iframe cross site text replacement / iframe website text replacement

【Flutter 问题系列第 6 篇】如何在 Flutter 中实现列表消息的滚动效果

Project training 10 - backup of specific databases

It is known that the transverse grain pressure resistance of a certain wood obeys n (x, D2). Now ten specimens are tested for transverse grain pressure resistance, and the data are as follows: (unit:
随机推荐
使用TSA包中的 beersales 数据集建立TAR模型
Model Workshop
Expandable to Max – MCU and MPU development, using the same license
执行Oracle的SQL语句报错【ORA-00904: “CREATETIME“: 标识符无效】、【ORA-00913: 值过多】解决办法
Redis data structure
1.打开R程序,使用 apply 函数计算1到12按先后次序每隔3个数一组的和。即,计算1+4+7+10=?2+5+8+11=?,3+6+9+12=?
LeetCode+ 16 - 20
Data and information resource sharing platform (VIII)
Data and information resource sharing platform (V)
HyperLeger Fabric安装
细数十大信息安全原则
2022最新软件测试面试题常问的30道【持续更新~】
OSS stores and exports related content
Prefer "big and small weeks", only write 200 lines of code every day, and the monthly salary of 8k-17k people will rise again
Is qiniu's securities account true? Is it safe?
嵌入式软件开发中的2种调试技术
宝塔计划任务Shell脚本定时删除某各目录下所有文件【记录】
30 | 怎么重设消费者组位移?
Fiddler creates an autoresponder
Introduction to software testing: the concept and process of software testing (brilliant content)