Files
Data-Structure/Dev-C++/ExerciseBook/04.13/String.h
2019-11-12 23:47:30 +08:00

44 lines
1014 B
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*===========================
* 习题4.10~4.14中使用的字符串
============================*/
#ifndef STRING_H
#define STRING_H
#include <stdlib.h>
#include <string.h> // 提供 strlen 原型
#include "Status.h" //**▲01 绪论**//
/* 字符串类型 */
typedef char* StringType;
// 初始化构造一个值为s的串t
void StrAssign(StringType* t, const char* s);
// 比较返回s与t的大小如果大小一致返回0
int StrCompare(StringType s, StringType t);
// 计数返回字符串s的长度
int StrLength(StringType s);
// 联接返回由s与t联接后的串
StringType Concat(StringType s, StringType t);
// 求子串从s的start位置起截取len个字符后返回
StringType SubString(StringType s, int start, int len);
// 查找从s的pos位置起查找t如果找到返回其位置
int Index(StringType s, StringType t, int pos);
// 插入在s的pos处插入t
Status StrInsert(StringType* s, int pos, StringType t);
// 删除从s的pos位置起删除len个字符
Status StrDelete(StringType* s, int pos, int len);
// 输出字符串
void StrPrint(StringType s);
#endif