当前位置:网站首页>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])
边栏推荐
- 300题 线代第一讲行列式
- 功能测试之设计语言测试:功能测试包含哪些测试?分别有什么作用
- Relevant knowledge of flowable BPMN
- Redis data structure
- Data and information resource sharing platform (IV)
- Why is the kotlin language not popular now?
- MySQL learning child query
- Im instant messaging source code with tutorial /uniapp instant messaging source code, with installation tutorial
- Halcon combined with C # to detect surface defects -- affine transformation (II)
- Leetcode 501: mode in binary search tree
猜你喜欢
![30 frequently asked questions of 2022 latest software test interview questions [continuous update ~]](/img/43/12392286fe711c5ef15462c900e456.png)
30 frequently asked questions of 2022 latest software test interview questions [continuous update ~]

Project training 10 - backup of specific databases

Why is the kotlin language not popular now?

Apple CMS collection station source code - building tutorial - attached source code - new source code - development documents

Data and information resource sharing platform (VIII)

Executor - Shutdown、ShutdownNow、awaitTermination 详解与实战

LeetCode+ 21 - 25

第六章——分枝限界法

Fiddler simulates low-speed network environment

Ma8601 pin √ pin replaces Tang Ming fe1.1s without changing the circuit board | perfectly replaces fe1.1s scheme
随机推荐
Is it too late to teach yourself programming at 28? Is it reliable?
mysql 表机制
Electronic Society C language level 1 7. Draw rectangle
What are the restrictions on opening futures accounts? Where is the safest?
上海股票开户是安全的吗?
Apple CMS collection station source code - building tutorial - attached source code - new source code - development documents
The time (in minutes) required for a group of workers to cooperate to complete the assembly process of a part are as follows:
Data file nc6oa Txt consists of 6830 gene expression data from 33 cancer cell lines, each of which is a type of cancer cell. Please cluster the 33 cell lines according to the gene expression data (the
可扩展到Max–MCU和MPU开发,使用相同的许可证
中银证券股票开户安全吗?是正规的吗?
OSS stores and exports related content
Is qiniu's securities account true? Is it safe?
Is it safe to open an account in Shanghai Securities?
Im instant messaging source code with tutorial /uniapp instant messaging source code, with installation tutorial
Analysis of Genesis public chain
Clustered and non clustered indexes
VS的常用设置
Example analysis of SQL query optimization principle
Sealem Finance - a new decentralized financial platform based on Web3
Executor - Shutdown、ShutdownNow、awaitTermination 詳解與實戰