Character string processing method and device, computer storage medium and electronic equipment

文档序号:1073178 发布日期:2020-10-16 浏览:24次 中文

阅读说明:本技术 字符串处理方法及装置、计算机存储介质、电子设备 (Character string processing method and device, computer storage medium and electronic equipment ) 是由 黄富华 于 2020-07-23 设计创作,主要内容包括:本公开涉及计算机技术领域,提供了一种字符串处理方法、字符串处理装置、计算机存储介质、电子设备,其中,字符串处理方法包括:第一处理单元获取原始字符串,原始字符串为包括至少一组键值对的字符串,至少一组键值对包含第一关键字和第一键值;当检测出第一键值中包含特定字符时,第一处理单元向第一键值的起始位置和/或终止位置添加分割标识符,得到目标字符串;第一处理单元将目标字符串发送至第二处理单元,以使第二处理单元根据分割标识符对目标字符串进行解析以至少获得第一关键字和第一键值。本公开中的方法能够解决字符串转换为对象时转换出错的技术问题,简化处理步骤,提高字符串处理效率。(The present disclosure relates to the field of computer technology, and provides a character string processing method, a character string processing apparatus, a computer storage medium, and an electronic device, wherein the character string processing method includes: the method comprises the steps that a first processing unit obtains an original character string, wherein the original character string comprises at least one group of key value pairs, and the at least one group of key value pairs comprise a first keyword and a first key value; when detecting that the first key value contains the specific character, the first processing unit adds a segmentation identifier to the initial position and/or the end position of the first key value to obtain a target character string; the first processing unit sends the target character string to the second processing unit so that the second processing unit can analyze the target character string according to the segmentation identifier to at least obtain a first keyword and a first key value. The method can solve the technical problem of conversion error when the character string is converted into the object, simplify the processing steps and improve the character string processing efficiency.)

1. A method for processing a character string, comprising:

a first processing unit acquires an original character string, wherein the original character string comprises at least one group of key value pairs, and the at least one group of key value pairs comprises a first keyword and a first key value;

when the first key value is detected to contain a specific character, adding a segmentation identifier to the starting position and/or the ending position of the first key value by a first processing unit to obtain a target character string;

the first processing unit sends the target character string to a second processing unit so that the second processing unit analyzes the target character string according to the segmentation identifier to obtain at least the first keyword and the first key value.

2. The method of claim 1, further comprising:

determining a first character of the first key value as a starting position of the first key value, and adding the segmentation identifier before the starting position; and

and determining a tail character of the first key value as a termination position of the first key value, and adding the segmentation identifier after the termination position.

3. The method of claim 2, wherein the split identifier comprises a first split identifier and a second split identifier;

the first processing unit adds a segmentation identifier to a start position and/or an end position of the first key value to obtain a target character string, and the method comprises the following steps:

the first processing unit adds the first split identifier to a starting position of the first key value; and

and the first processing unit adds a second segmentation identifier to the termination position of the first key value to obtain the target character string.

4. The method according to any one of claims 1 to 3, further comprising:

the method comprises the steps that a first processing unit obtains a webpage format file obtained by converting an original rich text through a rich text editor;

a first processing unit determines keywords contained in the webpage format file and key values corresponding to the keywords;

and the first processing unit splices each keyword and the key value to obtain the original character string.

5. A method according to any one of claims 1 to 3, wherein the specific character comprises a punctuation mark and/or a line break.

6. The method of claim 1, further comprising:

when the specific character is detected not to be contained in the first key value, the first processing unit sends the original character string to a second processing unit, so that the second processing unit converts the original character string into a target object.

7. A character string processing apparatus, comprising:

the system comprises a first processing unit, a second processing unit and a third processing unit, wherein the first processing unit is used for acquiring an original character string, and the original character string is a character string comprising at least one group of key value pairs, and the at least one group of key value pairs comprises a first keyword and a first key value;

when the first key value is detected to contain specific characters, adding a segmentation identifier to the starting position and/or the ending position of the first key value to obtain a target character string, and sending the target character string to a second processing unit;

and the second processing unit is used for analyzing the target character string according to the segmentation identifier so as to obtain at least the first keyword and the first key value.

8. The apparatus of claim 7, further comprising a splicing unit;

the splicing unit is used for acquiring a webpage format file obtained by converting the original rich text by the rich text editor; determining keywords contained in the webpage format file and key values corresponding to the keywords; and splicing each keyword and the key value to obtain the original character string.

9. A computer storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the character string processing method of any one of claims 1 to 6.

10. An electronic device, comprising:

a processor; and

a memory for storing executable instructions of the processor;

wherein the processor is configured to execute the character string processing method of any one of claims 1 to 6 via execution of the executable instructions.

17页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种文档视觉效果的获取方法和装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!