当前位置: 首页 > news >正文

第 4 章 串(串的块链存储实现)

1. 背景说明

该实现和链表的实现极为相似,只是将链接的内存拆分为具体的大小的块。

2.  示例代码

1). status.h

/* DataStructure 预定义常量和类型头文件 */#ifndef STATUS_H
#define STATUS_H#define CHECK_NULL(pointer) if (!(pointer)) { \printf("FuncName: %-15s Line: %-5d ErrorCode: %-3d\n", __func__, __LINE__, ERR_NULL_PTR); \return NULL; \
}#define CHECK_RET(ret) if (ret != RET_OK) { \printf("FuncName: %-15s Line: %-5d ErrorCode: %-3d\n", __func__, __LINE__, ret); \return ret; \
}#define CHECK_VALUE(value, ERR_CODE) if (value) { \printf("FuncName: %-15s Line: %-5d ErrorCode: %-3d\n", __func__, __LINE__, ERR_CODE); \return ERR_CODE; \
}#define CHECK_FALSE(value, ERR_CODE) if (!(value)) { \printf("FuncName: %-15s Line: %-5d ErrorCode: %-3d\n", __func__, __LINE__, ERR_CODE); \return FALSE; \
} /* 函数结果状态码 */
#define TRUE 					1			/* 返回值为真 */
#define FALSE 					0			/* 返回值为假 */
#define RET_OK 					0			/* 返回值正确 */
#define INFEASIABLE    		   	2			/* 返回值未知 */
#define ERR_MEMORY     		   	3			/* 访问内存错 */
#define ERR_NULL_PTR   			4			/* 空指针错误 */
#define ERR_MEMORY_ALLOCATE		5			/* 内存分配错 */
#define ERR_NULL_STACK			6			/* 栈元素为空 */
#define ERR_PARA				7			/* 函数参数错 */
#define ERR_OPEN_FILE			8			/* 打开文件错 */
#define ERR_NULL_QUEUE			9			/* 队列为空错 */
#define ERR_FULL_QUEUE			10			/* 队列为满错 */
#define ERR_NOT_FOUND			11			/* 表项不存在 */
typedef int Status;							/* Status 是函数的类型,其值是函数结果状态代码,如 RET_OK 等 */
typedef int Bollean;						/* Boolean 是布尔类型,其值是 TRUE 或 FALSE */#endif // !STATUS_H

2) lString.h

/* 串的块链存储实现头文件 */#ifndef LSTRING_H
#define LSTRING_H#include "status.h"#define CHUNK_SIZE 4
#define BLANK '#'typedef struct Chunk {char str[CHUNK_SIZE];struct Chunk *next;
} Chunk;typedef struct {Chunk *head, *tail;int curLen;				/* 字符个数 */
} LString;/* 初始化(产生空串)字符串 T */
Status InitString(LString *T);/* 生成一个其值等于 chars 的串 T (要求 chars 中不包含填补空余的字符)成功返回 OK,否则返回 ERROR */
Status StrAssign(const char *chars, LString *T);/* 初始条件: 串 S 存在操作结果: 由串 S 复制得串 T(连填补空余的字符一块拷贝) */
Status StrCopy(const LString *S, LString *T);/* 初始条件:串 S 存在操作结果:若 S 为空串,则返回 TRUE,否则返回 FALSE */
Bollean StrEmpty(const LString *S);/* 若 S > T,则返回值 > 0;若 S = T,则返回值 = 0;若 S < T, 则返回值 < 0 */
int StrCompare(const LString *S, const LString *T);/* 返回 S 的元素个数,称为串的长度 */
int StrLength(const LString *S);/* 初始条件: 串 S 存在操作结果: 将 S 清为空串 */
Status ClearString(LString *S);/* 用 T 返回由 S1 和 S2 联接而成的新串 */
Status Concat(const LString *S1, const LString *S2, LString *T);/* 用 Sub 返回串 S 的第 pos 个字符起长度为 len 的子串其中, 1≤ pos ≤ StrLength(S) 且 0 ≤ len ≤ StrLength(S) - pos + 1 */
Status SubString(const LString *S, int pos, int len, LString *Sub);/* T 为非空串。若主串 S 中第 pos 个字符之后存在与 T 相等的子串则返回第一个这样的子串在 S 中的位置,否则返回 0 */
int Index(const LString *S, const LString *T, int pos);/* 压缩串(清除块中不必要的填补空余的字符) */
Status Zip(LString *S);/* 1 ≤ pos ≤ StrLength(S) + 1。在串 S 的第 pos 个字符之前插入串 T */
Status StrInsert(const LString *T, int pos, LString *S);/* 从串 S 中删除第 pos 个字符起长度为 len 的子串 */
Status StrDelete(int pos, int len, LString *S);/* 初始条件: 串 S, T 和 V 存在,T 是非空串(此函数与串的存储结构无关)操作结果: 用 V 替换主串 S 中出现的所有与 T 相等的不重叠的子串 */
Status Replace(const LString *T, const LString *V, LString *S);/*  输出字符串 T */
void StrPrint(const LString *T);#endif // !LSTRING_H

3) lString.c

/* 串的块链存储实现源文件 */#include "lString.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>/* 初始化(产生空串)字符串 T */
Status InitString(LString *T)
{CHECK_VALUE(!T, ERR_NULL_PTR);T->curLen = 0;T->head = NULL;T->tail = NULL;return RET_OK;
}/* 生成一个其值等于 chars 的串 T (要求 chars 中不包含填补空余的字符)成功返回 OK,否则返回 ERROR */
Status StrAssign(const char *chars, LString *T)
{CHECK_VALUE(!chars || !T, ERR_NULL_PTR);int length = (int)strlen(chars);CHECK_VALUE((length == 0) || strchr(chars, BLANK), ERR_PARA);T->curLen = length;int nodes = length / CHUNK_SIZE;if (length % CHUNK_SIZE) {nodes += 1;}Chunk *tail = NULL, *newNode = NULL;for (int i = 0; i < nodes; ++i) {newNode = (Chunk *)malloc(sizeof(Chunk));CHECK_VALUE(!newNode, ERR_NULL_PTR);if (i == 0) {T->head = tail = newNode;} else {tail->next = newNode;tail = newNode;}int j;for (j = 0; (j < CHUNK_SIZE) && (*chars); ++j) {*(tail->str + j) = *chars++;}if (!(*chars)) {T->tail = tail;tail->next = NULL;while (j < CHUNK_SIZE) {*(tail->str + j++) = BLANK;}}}return RET_OK;
}/* 初始条件: 串 S 存在操作结果: 由串 S 复制得串 T(连填补空余的字符一块拷贝) */
Status StrCopy(const LString *S, LString *T)
{CHECK_VALUE(!S || !T, ERR_NULL_PTR);Chunk *sHead = S->head, *newNode = NULL;T->head = NULL;while (sHead) {newNode = (Chunk *)malloc(sizeof(Chunk));CHECK_VALUE(!newNode, ERR_MEMORY_ALLOCATE);newNode->next = NULL;(void)memcpy_s(newNode, sizeof(Chunk), sHead, sizeof(Chunk));if (T->head == NULL) {T->head = T->tail = newNode;} else {T->tail->next = newNode;T->tail = newNode;}sHead = sHead->next;}T->curLen = S->curLen;return RET_OK;
}/* 初始条件:串 S 存在操作结果:若 S 为空串,则返回 TRUE,否则返回 FALSE */
Bollean StrEmpty(const LString *S)
{CHECK_VALUE(!S, ERR_NULL_PTR);return (S->curLen == 0) ? TRUE : FALSE;
}static void GetNextCharPos(Chunk **node, int *order)
{++(*order);if (*order == CHUNK_SIZE) {*node = (*node)->next;*order = 0;}
}static void GetNextLegalCharPos(Chunk **node, int *order)
{while (*((*node)->str + *order) == BLANK) {GetNextCharPos(node, order);}
}/* 若 S > T,则返回值 > 0;若 S = T,则返回值 = 0;若 S < T, 则返回值 < 0 */
int StrCompare(const LString *S, const LString *T)
{CHECK_VALUE(!S || !T, ERR_NULL_PTR);Chunk *ps = S->head, *pt = T->head;for (int i = 0, js = 0, jt = 0; (i < S->curLen) && (i < T->curLen); ++i) {GetNextLegalCharPos(&ps, &js);GetNextLegalCharPos(&pt, &jt);if (*(ps->str + js) != *(pt->str + jt)) {return *(ps->str + js) - *(pt->str + jt);}GetNextCharPos(&ps, &js);GetNextCharPos(&pt, &jt);}return S->curLen - T->curLen;
}/* 返回 S 的元素个数,称为串的长度 */
int StrLength(const LString *S)
{CHECK_VALUE(!S, ERR_NULL_PTR);return S->curLen;
}/* 初始条件: 串 S 存在操作结果: 将 S 清为空串 */
Status ClearString(LString *S)
{CHECK_VALUE(!S, ERR_NULL_PTR);Chunk *p = S->head, *q = NULL;while (p) {q = p->next;free(p);p = q;}S->head = S->tail = NULL;S->curLen = 0;return RET_OK;
}/* 用 T 返回由 S1 和 S2 联接而成的新串 */
Status Concat(const LString *S1, const LString *S2, LString *T)
{CHECK_VALUE(!S1 || !S2 || !T, ERR_NULL_PTR);LString str1, str2;InitString(&str1);InitString(&str2);StrCopy(S1, &str1);StrCopy(S2, &str2);T->head = str1.head;str1.tail->next = str2.head;T->tail = str2.tail;T->curLen = str1.curLen + str2.curLen;return RET_OK;
}/* 用 Sub 返回串 S 的第 pos 个字符起长度为 len 的子串其中, 1≤ pos ≤ StrLength(S) 且 0 ≤ len ≤ StrLength(S) - pos + 1 */
Status SubString(const LString *S, int pos, int len, LString *Sub)
{CHECK_VALUE(!S || !Sub, ERR_NULL_PTR);CHECK_VALUE((pos < 1) || (pos > S->curLen) || (len < 0) || (len > (S->curLen - pos + 1)), ERR_PARA);int subLength = len / CHUNK_SIZE;if (len % CHUNK_SIZE) {subLength += 1;}Chunk *newNode = (Chunk *)malloc(sizeof(Chunk));Sub->head = newNode;Chunk *tail = Sub->head;for (int i = 0; i < subLength - 1; ++i) {newNode = (Chunk *)malloc(sizeof(Chunk));tail->next = newNode;tail = newNode;}tail->next = NULL;Sub->tail = tail;Sub->curLen = len;int lastPos = len % CHUNK_SIZE;if (lastPos) {for (int i = lastPos; i < CHUNK_SIZE; ++i) {*(newNode->str + i) = BLANK;}}Chunk *subHead = Sub->head, *sHead = S->head;int subPos = 0, count = 0;Bollean isEnd = FALSE;while (!isEnd) {for (int i = 0; i < CHUNK_SIZE; ++i) {if (*(sHead->str + i) == BLANK) {continue;}++count;if ((count >= pos) && (count <= pos + len - 1)) {if (subPos == CHUNK_SIZE) {subHead = subHead->next;subPos = 0;}*(subHead->str + subPos) = *(sHead->str + i);++subPos;if (count == pos + len - 1) {isEnd = TRUE;break;}}}sHead = sHead->next;}return RET_OK;
}/* T 为非空串。若主串 S 中第 pos 个字符之后存在与 T 相等的子串则返回第一个这样的子串在 S 中的位置,否则返回 0 */
int Index(const LString *S, const LString *T, int pos)
{CHECK_VALUE(!S || !T, ERR_NULL_PTR);int maxRange = StrLength(S) - StrLength(T) + 1;CHECK_VALUE((pos < 1) || (pos > maxRange), 0);LString sub;InitString(&sub);while (pos <= maxRange) {SubString(S, pos, StrLength(T), &sub);if (StrCompare(T, &sub) == 0) {return pos;}++pos;}return 0;
}/* 压缩串(清除块中不必要的填补空余的字符) */
Status Zip(LString *S)
{CHECK_VALUE(!S, ERR_NULL_PTR);char *newStr = (char *)malloc(sizeof(char) * (unsigned int)(S->curLen + 1));CHECK_VALUE(!newStr, ERR_NULL_PTR);Chunk *sHead = S->head;int count = 0;while (sHead) {for (int i = 0; i < CHUNK_SIZE; ++i) {if (*(sHead->str + i) != BLANK) {*(newStr + count) = *(sHead->str + i);++count;}}sHead = sHead->next;}*(newStr + count) = '\0';ClearString(S);StrAssign(newStr, S);return RET_OK;
}/* 1 ≤ pos ≤ StrLength(S) + 1。在串 S 的第 pos 个字符之前插入串 T */
Status StrInsert(const LString *T, int pos, LString *S)
{CHECK_VALUE(!T || !S, ERR_MEMORY_ALLOCATE);CHECK_VALUE((pos < 1) || (pos > StrLength(S) + 1), ERR_PARA);LString t;StrCopy(T, &t);Zip(S);int moveBlock = (pos - 1) / CHUNK_SIZE;int insertPos = (pos - 1) % CHUNK_SIZE;Chunk *sHead = S->head;if (pos == 1) {t.tail->next = S->head;S->head = t.head;} else if (insertPos == 0) {for (int i = 0; i < moveBlock - 1; ++i) {sHead = sHead->next;}Chunk *insertNext = sHead->next;sHead->next = t.head;t.tail->next = insertNext;if (insertNext == NULL) {S->tail = t.tail;}} else {for (int i = 0; i < moveBlock; ++i) {sHead = sHead->next;}Chunk *newBlock = (Chunk *)malloc(sizeof(Chunk));CHECK_VALUE(!newBlock, ERR_NULL_PTR);for (int i = 0; i < insertPos; ++i) {*(newBlock->str + i) = BLANK;}for (int i = insertPos; i < CHUNK_SIZE; ++i) {*(newBlock->str + i) = *(sHead->str + i);*(sHead->str + i) = BLANK;}newBlock->next = sHead->next;sHead->next = t.head;t.tail->next = newBlock;}S->curLen += t.curLen;Zip(S);return RET_OK;
}/* 从串 S 中删除第 pos 个字符起长度为 len 的子串 */
Status StrDelete(int pos, int len, LString *S)
{CHECK_VALUE(!S, ERR_NULL_PTR);CHECK_VALUE((pos < 1) || (pos > S->curLen - len + 1) || (len < 0), ERR_PARA);int count = 0;int currOrder = 0;Chunk *sHead = S->head;while (count < pos - 1) {GetNextLegalCharPos(&sHead, &currOrder);++count;GetNextCharPos(&sHead, &currOrder);}++count;if (*(sHead->str + currOrder) == BLANK) {GetNextLegalCharPos(&sHead, &currOrder);}while (count < pos + len) {GetNextLegalCharPos(&sHead, &currOrder);*(sHead->str + currOrder) = BLANK;++count;GetNextCharPos(&sHead, &currOrder);}S->curLen -= len;return RET_OK;
}/* 初始条件: 串 S, T 和 V 存在,T 是非空串(此函数与串的存储结构无关)操作结果: 用 V 替换主串 S 中出现的所有与 T 相等的不重叠的子串 */
Status Replace(const LString *T, const LString *V, LString *S)
{CHECK_VALUE(!T || !V || !S, ERR_NULL_PTR);CHECK_VALUE(StrEmpty(T), ERR_PARA);int pos = 1;do {pos = Index(S, T, pos);if (pos) {StrDelete(pos, StrLength(T), S);StrInsert(V, pos, S);pos += StrLength(V);}} while (pos);return RET_OK;
}/*  输出字符串 T */
void StrPrint(const LString *T)
{int count = 0;Chunk *tHead = T->head;while (count < T->curLen) {for (int i = 0; i < CHUNK_SIZE; ++i) {if (*(tHead->str + i) != BLANK) {printf("%c", *(tHead->str + i));++count;}}tHead = tHead->next;}
}

4) main.c

/* 入口程序源文件 */#include "lString.h"
#include <stdio.h>void ShowStr(const LString *S, const char *stringName);int main(void)
{LString t1, t2, t3, t4;InitString(&t1);InitString(&t2);InitString(&t3);InitString(&t4);printf("After initialize the string t1, the string t1 is %s,""the length of string t1 is %d\n", (StrEmpty(&t1) == TRUE) ? "empty" : "not empty",StrLength(&t1));char *s1 = "ABCDEFGHI", *s2 = "12345", *s3 = "", *s4 = "asd#tr", *s5 = "ABCD";Status ret = StrAssign(s3, &t1);if (ret == RET_OK) {ShowStr(&t1, "t1");}ret = StrAssign(s4, &t1);if (ret == RET_OK) {ShowStr(&t1, "t1");}ret = StrAssign(s1, &t1);if (ret == RET_OK) {ShowStr(&t1, "t1");}printf("After assign s1 to the string t1, the string t1 is %s,""the length of string t1 is %d\n", (StrEmpty(&t1) == TRUE) ? "empty" : "not empty",StrLength(&t1));ret = StrAssign(s2, &t2);if (ret == RET_OK) {ShowStr(&t2, "t2");}StrCopy(&t1, &t3);ShowStr(&t3, "t3");ret = StrAssign(s5, &t4);if (ret == RET_OK) {ShowStr(&t4, "t4");}Replace(&t4, &t2, &t3);ShowStr(&t3, "t3");ClearString(&t1);printf("After clear string t1, the string t1 is %s,""the length of string t1 is %d\n", (StrEmpty(&t1) == TRUE) ? "empty" : "not empty",StrLength(&t1));Concat(&t2, &t3, &t1);ShowStr(&t1, "t1");Zip(&t1);ShowStr(&t1, "t1");int pos = Index(&t1, &t3, 1);printf("pos = %d\n", pos);printf("To insert the string t2 before the posTh character of the string t1, enter pos: ");scanf_s("%d", &pos);StrInsert(&t2, pos, &t1);ShowStr(&t1, "t1");int len;printf("Please input the position and length of the subString of t1: ");scanf_s("%d%d", &pos, &len);ClearString(&t2);SubString(&t1, pos, len, &t2);ShowStr(&t2, "t2");printf("StrCompare(&t1, &t2) = %d\n", StrCompare(&t1, &t2));printf("Please input the position and length of the string t1 to be delete: ");scanf_s("%d%d", &pos, &len);StrDelete(pos, len, &t1);ShowStr(&t1, "t1");t1.head->str[0] = BLANK;t1.curLen--;printf("t1.head->str[0] = %c\n", t1.head->str[0]);ShowStr(&t1, "t1");Zip(&t1);printf("t1.head->str[0] = %c\n", t1.head->str[0]);ShowStr(&t1, "t1");ClearString(&t1);ClearString(&t2);ClearString(&t3);ClearString(&t4);return 0;
}void ShowStr(const LString *S, const char *stringName)
{printf("The string %s is: ", stringName);StrPrint(S);printf("\n");
}

3. 运行示例

相关文章:

第 4 章 串(串的块链存储实现)

1. 背景说明 该实现和链表的实现极为相似&#xff0c;只是将链接的内存拆分为具体的大小的块。 2. 示例代码 1). status.h /* DataStructure 预定义常量和类型头文件 */#ifndef STATUS_H #define STATUS_H#define CHECK_NULL(pointer) if (!(pointer)) { \printf("FuncN…...

Element表格之表头合并、单元格合并

一、合并表头 el-table配置 :header-cell-style"headFirst"headFirst({ row, colunm, rowIndex, columnIndex }) {let base { background-color: rgba(67, 137, 249, 0.3), color: #333, text-align: center };//这里为了是将第一列的表头隐藏&#xff0c;就形成了合…...

go学习-JS的encodeURIComponent转go

背景 encodeURIComponent() 函数通过将特定字符的每个实例替换成代表字符的 UTF-8 编码的一个、两个、三个或四个转义序列来编码 URI&#xff08;只有由两个“代理”字符组成的字符会被编码为四个转义序列&#xff09;。 与 encodeURI() 相比&#xff0c;此函数会编码更多的字…...

MySQL索引、事务与存储引擎

索引 事务 存储引擎 一、索引1.1 索引的概念1.2 索引的实现原理1.2 索引的作用1.3 创建索引的依据1.4 索引的分类和创建1.4.1 普通索引 index1.4.2 唯一索引 unique1.4.3 主键索引 primary key1.4.4 组合索引&#xff08;单列索引与多列索引&#xff09;1.4.5 全文索引 fulltex…...

【Spring面试】八、事务相关

文章目录 Q1、事务的四大特性是什么&#xff1f;Q2、Spring支持的事务管理类型有哪些&#xff1f;Spring事务实现方式有哪些&#xff1f;Q3、说一下Spring的事务传播行为Q4、说一下Spring的事务隔离Q5、Spring事务的实现原理Q6、Spring事务传播行为的实现原理是什么&#xff1f…...

Windows平台Qt6中UTF8与GBK文本编码互相转换、理解文本编码本质

快速答案 UTF8转GBK QString utf8_str"中UTF文"; std::string gbk_str(utf8_str.toLocal8Bit().data());GBK转UTF8 std::string gbk_str_given_by_somewhere"中GBK文"; QString utf8_strQString::fromLocal8Bit(gbk_str_given_by_somewhere.data());正文…...

【探索Linux】—— 强大的命令行工具 P.9(进程地址空间)

阅读导航 前言一、内存空间分布二、什么是进程地址空间1. 概念2. 进程地址空间的组成 三、进程地址空间的设计原理1. 基本原理2. 虚拟地址空间 概念 大小和范围 作用 虚拟地址空间的优点 3. 页表 四、为什么要有地址空间五、总结温馨提示 前言 前面我们讲了C语言的基础知识&am…...

ESP32主板-MoonESP32

产品简介 Moon-ESP32主板&#xff0c;一款以双核芯片ESP32-E为主芯片的主控板&#xff0c;支持WiFi和蓝牙双模通信&#xff0c;低功耗&#xff0c;板载LED指示灯&#xff0c;引出所有IO端口&#xff0c;并提供多个I2C端口、SPI端口、串行端口&#xff0c;方便连接&#xff0c;…...

Python 图片处理笔记

import numpy as np import cv2 import os import matplotlib.pyplot as plt# 去除黑边框 def remove_the_blackborder(image):image cv2.imread(image) #读取图片img cv2.medianBlur(image, 5) #中值滤波&#xff0c;去除黑色边际中可能含有的噪声干扰#medianBlur( Inp…...

SpringCloud Ribbon--负载均衡 原理及应用实例

&#x1f600;前言 本篇博文是关于SpringCloud Ribbon的基本介绍&#xff0c;希望你能够喜欢 &#x1f3e0;个人主页&#xff1a;晨犀主页 &#x1f9d1;个人简介&#xff1a;大家好&#xff0c;我是晨犀&#xff0c;希望我的文章可以帮助到大家&#xff0c;您的满意是我的动力…...

Redis的介绍以及简单使用

Redis&#xff08;Remote Dictionary Server&#xff09;是一个开源的内存数据存储系统&#xff0c;它以键值对的形式将数据存在内存中&#xff0c;并提供灵活、高性能的数据访问方式。Redis具有高速读写能力和丰富的数据结构支持&#xff0c;可以广泛应用于缓存、消息队列、实…...

ad18学习笔记十二:如何把同属性的元器件全部高亮?

1、先选择需要修改的器件的其中一个。 2、右键find similar objects&#xff0c;然后在弹出的对话框中&#xff0c;将要修改的属性后的any改为same 3、像这样勾选的话&#xff0c;能把同属性的元器件选中&#xff0c;其他器件颜色不变 注意了&#xff0c;如果这个时候&#xff…...

SpringSecurity 核心过滤器——SecurityContextPersistenceFilter

文章目录 前言过滤器介绍用户信息的存储获取用户信息存储用户信息获取用户信息 处理逻辑总结 前言 SecurityContextHolder&#xff0c;这个是一个非常基础的对象&#xff0c;存储了当前应用的上下文SecurityContext&#xff0c;而在SecurityContext可以获取Authentication对象…...

反转单链表

思路图1&#xff1a; 代码&#xff1a; struct ListNode* reverseList(struct ListNode* head){if(headNULL)//当head是空链表时 {return head; }struct ListNode* n1NULL;struct ListNode* n2head;struct ListNode* n3head->next;if(head->nextNULL)//当链表只有一个节…...

加速新药问世,药企如何利用云+网的优势?

随着计算能力的不断提高和人工智能技术的迅速发展&#xff0c;药物研发领域正迎来一场革命。云端强大的智能算法正成为药物研发企业的得力助手&#xff0c;推动着药物的精确设计和固相筛选。这使得药物设计、固相筛选以及药物制剂开发的时间大幅缩短&#xff0c;有望加速新药物…...

C++中string对象之间比较、char*之间比较

#include <cstring> //char* 使用strcmp #include <string> //string 使用compare #include <iostream> using namespace std; int main() {string stringStr1 "42";string stringStr2 "42";string stringStr3 "213";cout …...

MVVM模式理解

链接&#xff1a; MVVM框架理解及其原理实现 - 知乎 (zhihu.com) 重点&#xff1a; 1.将展示的界面窗口和创建的构件是数据进行分离 2.利用一个中间商进行数据的处理&#xff0c;所有的数据通过中间商进行处理...

js常用的数组处理方法

some 方法 用于检查数组中是否至少有一个元素满足指定条件。如果有满足条件的元素&#xff0c;返回值为 true&#xff0c;否则返回 false。 const numbers [1, 2, 3, 4, 5];const hasEvenNumber numbers.some((number) > number % 2 0); console.log(hasEvenNumber); /…...

[Document]VectoreStoreToDocument开发

该document是用来检索文档的。 第一步&#xff1a;定义组件对象&#xff0c;该组件返回有两种类型&#xff1a;document和text。 第二步&#xff1a;获取需要的信息&#xff0c;向量存储库&#xff0c;这里我使用的是内存向量存储&#xff08;用该组件拿到文档&#xff0c;并检…...

【LeetCode-简单题】225. 用队列实现栈

文章目录 题目方法一&#xff1a;单个队列实现 题目 方法一&#xff1a;单个队列实现 入栈 和入队正常进行出栈的元素其实就是队列的尾部元素&#xff0c;所以直接将尾部元素弹出即可&#xff0c;其实就可以将除了最后一个元素的其他元素出队再加入队&#xff0c;然后弹出队首元…...

寻音捉影·侠客行企业应用:制药企业GMP培训录音中自动核查‘无菌操作’等SOP术语

寻音捉影侠客行企业应用&#xff1a;制药企业GMP培训录音中自动核查‘无菌操作’等SOP术语 1. 引言&#xff1a;制药企业的音频管理痛点 在制药企业的日常运营中&#xff0c;GMP&#xff08;良好生产规范&#xff09;培训是确保药品质量和生产安全的关键环节。每次培训都会产…...

从游戏到医疗:用Touch™和OpenHaptics 3.5解锁Windows力反馈应用新场景(附Unity与C++双环境配置要点)

从游戏到医疗&#xff1a;Touch™力反馈技术的跨界应用与开发实践 想象一下&#xff0c;外科医生在虚拟手术训练中感受到真实的组织阻力&#xff0c;汽车维修学员通过触觉反馈"触摸"到发动机零件的磨损痕迹&#xff0c;游戏玩家在射击游戏中体验到不同武器的后坐力差…...

Steam创意工坊下载终极指南:WorkshopDL让你轻松获取海量模组

Steam创意工坊下载终极指南&#xff1a;WorkshopDL让你轻松获取海量模组 【免费下载链接】WorkshopDL WorkshopDL - The Best Steam Workshop Downloader 项目地址: https://gitcode.com/gh_mirrors/wo/WorkshopDL 还在为无法访问Steam创意工坊而烦恼吗&#xff1f;Work…...

GCC开发者转LLVM必看:模块化设计带来的5个关键工作流变革

GCC开发者转LLVM必看&#xff1a;模块化设计带来的5个关键工作流变革 当GCC开发者第一次接触LLVM时&#xff0c;往往会惊讶于其完全不同的设计哲学。就像从单块巨石建筑转向预制模块化结构&#xff0c;LLVM的三段式架构不仅改变了代码的组织方式&#xff0c;更从根本上重塑了编…...

全面掌握ESP WiFi中继器DHCP服务器配置:高效管理嵌入式设备网络

全面掌握ESP WiFi中继器DHCP服务器配置&#xff1a;高效管理嵌入式设备网络 【免费下载链接】esp_wifi_repeater A full functional WiFi Repeater (correctly: a WiFi NAT Router) 项目地址: https://gitcode.com/gh_mirrors/es/esp_wifi_repeater ESP WiFi中继器是一款…...

ARM Cortex-M中断状态寄存器实战:从配置到调试的完整指南

ARM Cortex-M中断状态寄存器实战&#xff1a;从配置到调试的完整指南 在嵌入式开发领域&#xff0c;中断处理是系统实时响应的核心机制。作为ARM Cortex-M系列处理器的开发者&#xff0c;深入理解中断状态寄存器(Interrupt Status Register)的工作原理和操作技巧&#xff0c;能…...

VMware Unlocker:在非苹果硬件上运行macOS虚拟机的完整解决方案

VMware Unlocker&#xff1a;在非苹果硬件上运行macOS虚拟机的完整解决方案 【免费下载链接】unlocker 项目地址: https://gitcode.com/gh_mirrors/unloc/unlocker VMware Unlocker是一个开源工具&#xff0c;专门解决在非苹果硬件上使用VMware虚拟机运行macOS系统时的…...

JS知识点汇总(十九)--ajax

1. 说说ajax的原理&#xff0c;以及如何实现&#xff1f; AJAX 全称(Async Javascript and XML) 即异步的 JavaScript 和 XML&#xff0c;是一种创建交互式网页应用的网页开发技术&#xff0c;可以在不重新加载整个网页的情况下&#xff0c;与服务器交换数据&#xff0c;并且更…...

如何通过AndroidAnnotations与Kotlin扩展函数实现极速Android开发:新手必备指南

如何通过AndroidAnnotations与Kotlin扩展函数实现极速Android开发&#xff1a;新手必备指南 【免费下载链接】androidannotations Fast Android Development. Easy maintainance. 项目地址: https://gitcode.com/gh_mirrors/an/androidannotations AndroidAnnotations是…...

各行业开发经验全面解析,本凡科技助你快速提升项目成功率

在当今快速发展的市场中&#xff0c;各行业的开发经验已成为决定项目成败的关键因素。每个行业都面临独特的挑战和需求&#xff0c;了解这些特性有助于企业制定有效的开发策略。例如&#xff0c;科技行业通常需要快速响应市场变化&#xff0c;而食品行业则需关注合规性和安全标…...