当前位置:网站首页>Preliminary understanding of string
Preliminary understanding of string
2022-07-23 17:16:00 【Code of dead of night】
One 、 Related concepts of string
1、 Definition of string : A finite sequence of zero or more arbitrary characters .
2、 Empty string is generally used ∅ Express .
3、 The strings are equal : If and only if the length of two strings is equal and At each corresponding position The characters of are the same , The two strings are equal . All empty strings are equal .
4、 Type definition of string :
ADT String {
Data objects :.......
Data relation :.......
Basic operation :
(1) StrAssign (&T,chars) // String assignment
(2) StrCompare (S,T) // String comparison
(3) StrLength (S) // Find the length of the string
(4) Concat(&T,S1,S2) // String connection
(5) SubString(&Sub,S,pos,len) // substring
(6) StrCopy(&T,S) // String copy
(7) StrEmpty(S) // The string is empty
(8) ClearString (&S) // Empty string
(9) Index(S,T,pos) // The position of the substring
(11) Replace(&S,T,V) // String replacement
(12) Strlnsert(&S,pos,T) // Substring insertion
(12) StrDelete(&S,pos,len) // Substring deletion
(13) DestroyString(&S) // String destruction
}ADT String
Two 、 String storage structure
1、 Chain storage structure of string —— Block chain structure
#define CHUNKSIZE 80 // The size of the block can be defined by the user
typedef struct Chunk{
char ch[CHUNKSIZE];
struct Chunk *next;
}Chunk;
typedef struct{
Chunk *head,*tail; // The head and tail pointers of the string
int curlen; // The current length of the string
}LString; // Block chain structure of string 2、 The sequential storage structure of a string
#define MAXLEN 255
typedef struct{
char ch[MAXLEN+1]; // A one-dimensional array of storage strings
int length; // The current length of the string
}SString;边栏推荐
猜你喜欢
随机推荐
Search Binary Tree - find nodes, insert nodes, delete nodes
benthos杂记
Pinduoduo app product details interface to obtain activity_ ID value (pinduoduo activity_id interface)
Compose Canvas饼图效果绘制
pwn入门(3)堆
腾讯撕开中国NFT的“遮羞布”
Notes on Microcomputer Principle and technical interface
MATLAB基础
Shell | ssh失败原因及解决方法不完全总结
Eureka notes
MySQL:不是MySQL问题的MySQL问题
Shrimp noodles: what do you know about the JVM memory layout?
Win11如何添加图片3D效果?Win11添加图片3D效果的方法
数组和特殊矩阵的压缩存储
Keil errors and solutions (1): fcarm - output name not specified, please check 'options for target - Utilities‘
[30. N-queen problem]
智慧物联网源码 带组态物联网源码 工业物联网源码:支持传感器解析服务,数据实时采集和远程控制
Leetcode-168.excel table column name
[web vulnerability exploration] SQL injection vulnerability
Docker install redis









