CN106469186A - A kind of method and device of character string comparison - Google Patents

A kind of method and device of character string comparison Download PDF

Info

Publication number
CN106469186A
CN106469186A CN201610751100.7A CN201610751100A CN106469186A CN 106469186 A CN106469186 A CN 106469186A CN 201610751100 A CN201610751100 A CN 201610751100A CN 106469186 A CN106469186 A CN 106469186A
Authority
CN
China
Prior art keywords
character string
pointer
processed
electronic game
cryptographic hash
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610751100.7A
Other languages
Chinese (zh)
Inventor
吕天胜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Pixel Software Technology Co Ltd
Original Assignee
Beijing Pixel Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Pixel Software Technology Co Ltd filed Critical Beijing Pixel Software Technology Co Ltd
Priority to CN201610751100.7A priority Critical patent/CN106469186A/en
Publication of CN106469186A publication Critical patent/CN106469186A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

The invention discloses a kind of method and device of character string comparison, the embodiment of the present invention corresponds to pointer to the character string in electronic game program to be processed in advance, when the character string comparison instruction in subsequently received electronic game program, whether equal directly compare the corresponding pointer of character string.Further, in pointer corresponding to the character string in electronic game program to be processed, carry out the comparison of character string, unique pointer is arranged to identical character string, thus the comparison of character string that is easier and quickly completing electronic game program, improve and compare speed, improve performance and the arithmetic speed of electronic game program.

Description

A kind of method and device of character string comparison
Technical field
The present invention relates to the treatment technology of computer data, particularly to a kind of method and device of character string comparison.
Background technology
Electronic game develops towards the direction of large-scale three-dimensional electronic game.Therefore, in existing electronic game program, The character string comparison operation of enormous amount can be run into, compare operation of the character strings such as resource name etc..In electronic game In program, character string is mainly used in programming, conceptual illustration and function and explains, usually by numeral, letter and/or underscore group The a string character becoming, is the data type representing text in programming language.
At present, in the character string comparison to electronic game program, typically using direct manner of comparison it is simply that adopting C++ The std of programming language::In string order==algorithm, or directly compared using the strmp function of C programming language, obtain To the whether equal result of character string.
Using this direct manner of comparison, the character string of electronic game program is compared, is either based on C++ and programs Language or C programming language, are inherently intended to each character of comparison character string one by one, this comparative approach efficiency comparison Low, the data volume of particularly electronic game program is big and client process ability low in the case of, had a strong impact on electronic game The performance of program and arithmetic speed are so that the Experience Degree of player declines.
Content of the invention
In view of this, the embodiment of the present invention provides a kind of method of character string comparison, and the method can improve electronic game The comparison speed of the character string of program, thus improve performance and the arithmetic speed of electronic game program.
The embodiment of the present invention also provides a kind of device of character string comparison, and this device can improve the word of electronic game program The comparison speed of symbol string, thus improve performance and the arithmetic speed of electronic game program.
According to above-mentioned purpose, the present invention is realized in:
A kind of method of character string comparison, including:
Process the character string in electronic game, be that character string arranges corresponding pointer;
After character string instruction is compared in reception, determine whether character string is identical according to the corresponding pointer of character string.
Described determine whether character string is mutually all according to the corresponding pointer of character string:
If the corresponding pointer of character string differs, character string differs, if the corresponding pointer of character string is identical, Character string is identical.
Described for character string arrange corresponding pointer be:
For the identical characters string in electronic game, same pointer is set.
Described for character string arrange corresponding pointer be:
A, setting memory headroom, described memory headroom is used for storing processed character string;
B, setting map information, including the pointer of processed cryptographic Hash and corresponding processed character string;
C, character string to be processed is calculated by hash algorithm, obtain cryptographic Hash;
D, search whether there is identical cryptographic Hash in map information, if it is, execution step e;If it is not, then Execution step h;
E, client judge the character string that whether corresponding with identical cryptographic Hash character string to be processed is processed and stores Equal, if not, execution step f;If it is, execution step g;
After the cryptographic Hash of character string to be processed is increased by 1 by f, client, return to step d continues executing with;
G, client store in map information to be had the processed of identical cryptographic Hash with character string to be processed and stores Character string pointer;
Character string to be processed is stored in the memory headroom of setting by h, client as processed character string, and will Corresponding cryptographic Hash and pointer store in map information.
Described map information is mapping map map, and shaping numerical value therein is the cryptographic Hash of processed character string, is designated as Key, pointer is value, represents the char* pointer pointing to processed character string.
A kind of device of character string comparison, including:Pretreatment unit, memory element and compare operating unit, wherein,
Pretreatment unit, for processing the character string in electronic game, is that character string arranges corresponding pointer;
Memory element, for storing the corresponding relation of character string and pointer;
Relatively operating unit, after being used for receiving and comparing character string instruction, determines character according to the corresponding pointer of character string Whether string is identical.
Described pretreatment unit, is additionally operable to for the identical characters string in electronic game to arrange same pointer.
Described compare operating unit, if be additionally operable to determine the corresponding pointer of character string differ, character string differs, If the corresponding pointer of character string is identical, character string is identical.
As can be seen from the above scheme, the embodiment of the present invention is in advance to the character string pair in electronic game program to be processed Answer pointer, when the character string comparison instruction in subsequently received electronic game program, directly compare the corresponding pointer of character string Whether equal.Further, in pointer corresponding to the character string in electronic game program to be processed, enter line character The comparison of string, arranges unique pointer to identical character string, thus easier and quickly complete electronic game program The comparison of character string, improves and compares speed, improves performance and the arithmetic speed of electronic game program.
Brief description
Fig. 1 is the method flow diagram of character string comparison provided in an embodiment of the present invention;
Fig. 2 is the method flow arranging pointer for the character string in handled electronic game provided in an embodiment of the present invention Figure;
Fig. 3 is the apparatus structure schematic diagram of character string comparison provided in an embodiment of the present invention.
Specific embodiment
For making the objects, technical solutions and advantages of the present invention become more apparent, develop simultaneously embodiment referring to the drawings, right The present invention is described in further detail.
In order to improve the comparison speed of the character string of electronic game program, thus improving performance and the fortune of electronic game program Calculate speed, particularly the data volume in electronic game program is big and client process ability low in the case of so that electronic game Program occurs without delay, improves the Experience Degree of player.The embodiment of the present invention is in advance to the word in electronic game program to be processed The corresponding pointer of symbol string, when the character string comparison instruction in subsequently received electronic game program, directly compares character string and corresponds to Pointer whether equal.Further, in pointer corresponding to the character string in electronic game program to be processed, enter The comparison of line character string, arranges unique pointer to identical character string.
Fig. 1 is the method flow diagram of character string comparison provided in an embodiment of the present invention, and it concretely comprises the following steps:
Character string in step 101, client process electronic game, is that character string arranges corresponding pointer;
Step 102, client receive after comparing character string instruction, determine that character string is according to the corresponding pointer of character string No identical.
In this step, if the corresponding pointer of character string differs, character string differs, if character string is corresponding Pointer is identical, then character string is identical.
In the method, the identical characters string in electronic game, the pointer arranging in a step 101 is identical.
In step 101 in the method, character string in client process electronic game, is that character string setting is corresponding Pointer is as shown in Fig. 2 Fig. 2 is the side arranging pointer for the character string in handled electronic game provided in an embodiment of the present invention Method flow chart, it concretely comprises the following steps:
Step 201, client setting memory headroom, the character string of the processed electronic game of described memory headroom storage;
Step 202, client setting map information, the cryptographic Hash including processed character string and corresponding pointer;
In this step, map information is mapping map (map), and shaping numerical value therein is set to processed character string Cryptographic Hash, be designated as key, pointer is value, represents the char* pointer pointing to processed character string;
Character string to be processed is calculated by step 203, client by hash algorithm, obtains cryptographic Hash to be processed;
Step 204, client search whether there is identical cryptographic Hash in map information, if it is, executing step Rapid 205;If it is not, then execution step 208;
Step 205, client judge whether character string is equal with the stored corresponding character string of identical cryptographic Hash, such as Really no, execution step 206;If it is, execution step 207;
In this step, although having the cryptographic Hash of some character strings calculating to be processed and character that is treated and storing String is identical, but character string to be processed is different from treated character string, referred to as collides Hash situation;In order to avoid going out Existing this situation it is necessary to further to character string to be processed and character string that is treated and storing further than Relatively;
After the cryptographic Hash of character string to be processed is increased by 1 by step 206, client, return to step 204 continues executing with;
In this step, change the cryptographic Hash of character string to be processed so that situation collision Hash reduces;
Step 207, client return to the place with character string to be processed with identical cryptographic Hash in map information The pointer of the character string managed and store;
Step 208, client store character string to be processed in the memory headroom of setting, and will process calculate The cryptographic Hash of character string and pointer store in map information.
So, client is just provided with pointer for each character string in electronic game, and identical characters string therein Pointer identical.
After subsequent client receives and compares the instruction of character string, the pointer directly transferring character string is compared, It is assured that whether character string is identical.Complete the comparison work of the character string in electronic game.
In embodiments of the present invention, the hash value algorithms calculating character string to be processed are to set Hash seed and character String, obtains cryptographic Hash, and Hash seed is to calculate the tired of cryptographic Hash employing to take advantage of the factor, and this example is set to 131, the cryptographic Hash of employing The function calculating is BKDRHash, specially:
In embodiments of the present invention, identical cryptographic Hash the tool that character string is processed are searched whether in map Body process is:
Fig. 3 is the apparatus structure schematic diagram of character string comparison provided in an embodiment of the present invention, as illustrated, including:In advance Processing unit, memory element and compare operating unit, wherein,
Pretreatment unit, for processing the character string in electronic game, is that character string arranges corresponding pointer;
Memory element, for storing the corresponding relation of character string and pointer;
Relatively operating unit, after being used for receiving and comparing character string instruction, determines character according to the corresponding pointer of character string Whether string is identical.
In the structure shown here, described pretreatment unit, is additionally operable to for the identical characters string in electronic game to arrange same finger Pin.
In the structure shown here, described compare operating unit, if be additionally operable to determine the corresponding pointer of character string differ, word Symbol string differs, if the corresponding pointer of character string is identical, character string is identical.
The object, technical solutions and advantages of the present invention are further described, institute by above act preferred embodiment It should be understood that the foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all the present invention's Spirit and principle within, any modification, equivalent and improvement of being made etc., should be included in protection scope of the present invention it Interior.

Claims (8)

1. a kind of method of character string comparison is it is characterised in that include:
Process the character string in electronic game, be that character string arranges corresponding pointer;
After character string instruction is compared in reception, determine whether character string is identical according to the corresponding pointer of character string.
2. the method for claim 1 is it is characterised in that whether described determine character string according to the corresponding pointer of character string Mutually it is all:
If the corresponding pointer of character string differs, character string differs, if the corresponding pointer of character string is identical, character String is identical.
3. the method for claim 1 is it is characterised in that described for the character string corresponding pointer of setting be:
For the identical characters string in electronic game, same pointer is set.
4. method as claimed in claim 2 is it is characterised in that described for the character string corresponding pointer of setting be:
A, setting memory headroom, described memory headroom is used for storing processed character string;
B, setting map information, including the pointer of processed cryptographic Hash and corresponding processed character string;
C, character string to be processed is calculated by hash algorithm, obtain cryptographic Hash;
D, search whether there is identical cryptographic Hash in map information, if it is, execution step e;If it is not, then execution Step h;
E, client judge that whether corresponding with identical cryptographic Hash character string to be processed character string that is processed and storing be equal, If not, execution step f;If it is, execution step g;
After the cryptographic Hash of character string to be processed is increased by 1 by f, client, return to step d continues executing with;
G, client store in map information has the processed of identical cryptographic Hash the word storing with character string to be processed The pointer of symbol string;
Character string to be processed is stored in the memory headroom of setting by h, client as processed character string, and will correspond to Cryptographic Hash and pointer store in map information.
5. method as claimed in claim 3 is it is characterised in that described map information is to map map map, shaping number therein It is worth the cryptographic Hash for processed character string, is designated as key, pointer is value, represents the char* pointing to processed character string Pointer.
6. a kind of device of character string comparison is it is characterised in that include:Pretreatment unit, memory element and to compare operation single Unit, wherein,
Pretreatment unit, for processing the character string in electronic game, is that character string arranges corresponding pointer;
Memory element, for storing the corresponding relation of character string and pointer;
According to the corresponding pointer of character string, relatively operating unit, after being used for receiving and comparing character string instruction, determines that character string is No identical.
7. device as claimed in claim 6 it is characterised in that
Described pretreatment unit, is additionally operable to for the identical characters string in electronic game to arrange same pointer.
8. device as claimed in claim 6 is it is characterised in that described compare operating unit, if being additionally operable to determine character string Corresponding pointer differs, then character string differs, if the corresponding pointer of character string is identical, character string is identical.
CN201610751100.7A 2016-08-29 2016-08-29 A kind of method and device of character string comparison Pending CN106469186A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610751100.7A CN106469186A (en) 2016-08-29 2016-08-29 A kind of method and device of character string comparison

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610751100.7A CN106469186A (en) 2016-08-29 2016-08-29 A kind of method and device of character string comparison

Publications (1)

Publication Number Publication Date
CN106469186A true CN106469186A (en) 2017-03-01

Family

ID=58229947

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610751100.7A Pending CN106469186A (en) 2016-08-29 2016-08-29 A kind of method and device of character string comparison

Country Status (1)

Country Link
CN (1) CN106469186A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018158663A1 (en) * 2017-03-03 2018-09-07 International Business Machines Corporation Compare string processing via inline decode-based micro-operations expansion
US10324717B2 (en) 2017-03-03 2019-06-18 International Business Machines Corporation Selecting processing based on expected value of selected character
US10564967B2 (en) 2017-03-03 2020-02-18 International Business Machines Corporation Move string processing via inline decode-based micro-operations expansion
US10613862B2 (en) 2017-03-03 2020-04-07 International Business Machines Corporation String sequence operations with arbitrary terminators
US10620956B2 (en) 2017-03-03 2020-04-14 International Business Machines Corporation Search string processing via inline decode-based micro-operations expansion
CN111090982A (en) * 2018-10-24 2020-05-01 迈普通信技术股份有限公司 Text comparison method and device, electronic equipment and computer readable storage medium
US10789069B2 (en) 2017-03-03 2020-09-29 International Business Machines Corporation Dynamically selecting version of instruction to be executed

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1866203A (en) * 2005-05-20 2006-11-22 腾讯科技(深圳)有限公司 Character string quoting method
CN101783803A (en) * 2010-01-29 2010-07-21 中兴通讯股份有限公司 Webpage filtering method and data card
CN102117217A (en) * 2010-11-29 2011-07-06 福建新大陆通信科技股份有限公司 Method for expanding functions with set-top box script
CN103139224A (en) * 2011-11-22 2013-06-05 腾讯科技(深圳)有限公司 Network file system and method for accessing network file system
CN103309893A (en) * 2012-03-15 2013-09-18 阿里巴巴集团控股有限公司 Character string comparing method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1866203A (en) * 2005-05-20 2006-11-22 腾讯科技(深圳)有限公司 Character string quoting method
CN101783803A (en) * 2010-01-29 2010-07-21 中兴通讯股份有限公司 Webpage filtering method and data card
CN102117217A (en) * 2010-11-29 2011-07-06 福建新大陆通信科技股份有限公司 Method for expanding functions with set-top box script
CN103139224A (en) * 2011-11-22 2013-06-05 腾讯科技(深圳)有限公司 Network file system and method for accessing network file system
CN103309893A (en) * 2012-03-15 2013-09-18 阿里巴巴集团控股有限公司 Character string comparing method and device

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10564967B2 (en) 2017-03-03 2020-02-18 International Business Machines Corporation Move string processing via inline decode-based micro-operations expansion
US10613862B2 (en) 2017-03-03 2020-04-07 International Business Machines Corporation String sequence operations with arbitrary terminators
US10324716B2 (en) 2017-03-03 2019-06-18 International Business Machines Corporation Selecting processing based on expected value of selected character
US10372447B2 (en) 2017-03-03 2019-08-06 International Business Machines Corporation Selecting processing based on expected value of selected character
US10372448B2 (en) 2017-03-03 2019-08-06 International Business Machines Corporation Selecting processing based on expected value of selected character
GB2574567A (en) * 2017-03-03 2019-12-11 Ibm Compare string processing via inline decode-based micro-operations expansion
US10324717B2 (en) 2017-03-03 2019-06-18 International Business Machines Corporation Selecting processing based on expected value of selected character
US10564965B2 (en) 2017-03-03 2020-02-18 International Business Machines Corporation Compare string processing via inline decode-based micro-operations expansion
WO2018158663A1 (en) * 2017-03-03 2018-09-07 International Business Machines Corporation Compare string processing via inline decode-based micro-operations expansion
US10620956B2 (en) 2017-03-03 2020-04-14 International Business Machines Corporation Search string processing via inline decode-based micro-operations expansion
US10789069B2 (en) 2017-03-03 2020-09-29 International Business Machines Corporation Dynamically selecting version of instruction to be executed
GB2574567B (en) * 2017-03-03 2020-05-27 Ibm Compare string processing via inline decode-based micro-operations expansion
US10747533B2 (en) 2017-03-03 2020-08-18 International Business Machines Corporation Selecting processing based on expected value of selected character
US10747532B2 (en) 2017-03-03 2020-08-18 International Business Machines Corporation Selecting processing based on expected value of selected character
CN111090982A (en) * 2018-10-24 2020-05-01 迈普通信技术股份有限公司 Text comparison method and device, electronic equipment and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN106469186A (en) A kind of method and device of character string comparison
CN108961052B (en) Verification method, storage method, device, equipment and medium of block chain data
CN109804363B (en) Connection using format modification by way of example
Drew et al. Polymorphic malware detection using sequence classification methods
AU2017408800B2 (en) Method and system of mining information, electronic device and readable storable medium
JP2021523464A5 (en)
EP3091450A1 (en) Method and system for performing binary searches
CN104142915A (en) Punctuation adding method and system
JP6912488B2 (en) Character string distance calculation method and device
CN105468588A (en) Character string matching method and apparatus
CN107609106B (en) Similar article searching method, device, equipment and storage medium
CN110569335A (en) triple verification method and device based on artificial intelligence and storage medium
US20210201163A1 (en) Genome Sequence Alignment System and Method
Mirghorbani et al. On finding k-cliques in k-partite graphs
CN106547743B (en) Translation method and system
CN109710950B (en) Bilingual alignment method, apparatus and system
US9298694B2 (en) Generating a regular expression for entity extraction
CN107341224A (en) The matching process and device of a kind of character string
CN109684632B (en) Natural semantic understanding method, device and computing equipment
KR101244945B1 (en) Webshell detecting apparatus using meta pattern
CN104680043B (en) A kind of guard method of executable file and device
JP6194180B2 (en) Text mask device and text mask program
CN113792232B (en) Page feature calculation method, page feature calculation device, electronic equipment, page feature calculation medium and page feature calculation program product
CN113360522B (en) Method and device for rapidly identifying sensitive data
Akram et al. Grammatical inference algorithms in matlab

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20170301

RJ01 Rejection of invention patent application after publication