当前位置:网站首页>C # getting started series (12) -- string
C # getting started series (12) -- string
2022-06-12 09:30:00 【InfoQ】
String Overview
String common properties
- Chars: Get current String The character at the specified character position in the object .
- Length: Get current String The number of characters in the object .
class Program
{
static void Main(string[] args)
{
string str = " I'm a string ";
Console.WriteLine(str[0]); // Output : I
Console.WriteLine(str.Length); // Output :7
Console.ReadLine();
}
}
String common methods
- Compare Method:Compare There are many ways to overload , Implement two strings according to the specified rules 、 The comparison operation of the specified range , Method returns an integer , Used to describe the relative position in the sorting of two strings .
- Concat Method:Concat There are many ways to overload , Realize the connection operation of the specified string or object .
- Contains Method: Returns a Boolean value , This value represents the specified String Whether the object appears in this string .
- EndsWith Method :: Returns a Boolean value , Determines whether the end of this string instance matches the specified string .
- StartsWith Method :: Returns a Boolean value , To determine whether the string starts with the specified substring .
- Equals Method:Equals Methods can be overloaded in many ways , The implementation determines two according to certain rules String Whether the instance has the same value .
- Format Method:Format Methods can be overloaded in many ways , Replaces one or more format items in the specified string with the string representation of the specified object .
- IndexOf Method:IndexOf Methods can be overloaded in many ways , Reports the index of the first occurrence of a specified character or string within a specified range in this instance .
- and 8 A similar approach is :IndexOfAny,LastIndexOf, LastIndexOfAny Other methods , Reports the index of a match of a specified character or string within a specified range in this instance .
- Insert Method:Insert Method inserts a specified index at the specified index position in this instance String example .
- Remove Method:Remove Method to delete the character specified in this instance .
- **Replace Method :**Replace Method to replace the character or substring specified in this instance .
- **Split Method :**Split There are many ways to overload , Realize the function of dividing the string according to the specified characters to form multiple substrings .
- Substring Method:Substring There are two ways to overload , Realize the function of substring the string according to the specified starting position and specified length .
- ToLower Methods and ToUpper Method: Converts characters in a string to lowercase , Or convert to uppercase .
- Trim Method: Delete all leading and trailing white space characters in the string . There is also “TrimStart” and “TrimEnd” They are the blank characters before and after deleting the string
边栏推荐
- Automated test learning path, come and learn
- Crazy temporary products: super low price, big scuffle and new hope
- QQ,微信能聊天都靠它(socket)?
- Auto.js学习笔记4:autojs打包后,大部分华为等大牌子手机无法安装?利用模拟器远程在autoPro里签名打包可以解决该问题。
- Introduction to applet
- 简单介绍线程和进程区别
- Distributed task scheduling
- DNA数字信息存储的研究进展
- Mysql5.7 partition table
- 科创人·神州数码集团CIO沈旸:最佳实践模式正在失灵,开源加速分布式创新
猜你喜欢

【极术公开课预告】Arm最强MCU内核Cortex-M85处理器,全方位助力物联网创新(有抽奖)

《真北》读书笔记

004:AWS数据湖解决方案

Four steps for sending rockertmq producer messages

Is it necessary to separate databases and tables for MySQL single table data of 5million?

After going to the bathroom, I figured out the ES search server

Es6-- common basic knowledge

005:数据湖与数据仓库的区别

软件定义存储概览(一篇就够)

Mysql5.7 partition table
随机推荐
Implementation of hotspot reference
gnu-efi开发环境设置
[cloud native] establishment of Eureka service registration
Difference between MySQL unreal reading and non repeatable reading
Leetcode 336 palindrome pair (palindrome string + hash)
Permission modifiers and code blocks
更改tabledata列名
Microservice gateway
Hotspot Metaspace
Distributed transaction solution 2: message queue to achieve final consistency
Crazy temporary products: super low price, big scuffle and new hope
Basic exercise decomposing prime factors
004:AWS数据湖解决方案
网络层IP协议 ARP&ICMP&IGMP NAT
2022 极术通讯-安谋科技纷争尘埃落定,本土半导体产业基石更稳
Mysql database ignores case
There must be something you want to know about software testing experience sharing
TAP 系列文章3 | Tanzu Application Platform 部署参考架构介绍
软件测试面试题精选
测试计划应该怎么写?一个思路教会你