A kind of method of calibration, device, terminal and the storage medium of barrage dataTechnical field
The present embodiments relate to barrage technical field more particularly to a kind of method of calibration, device, the terminals of barrage dataAnd storage medium.
Background technique
With the fast development of intelligent terminal, various application software are by development and application in intelligent terminal.Some applications are softPart be such as broadcast live software, often have the function of in video jukebox software barrage receive, the barrages such as parsing and push.Developing theseDuring application software, just whether the barrage data for needing to issue server carry out dependence test, to determine barrage functionOften operation.
Currently, server is according to default barrage protocol construction in the applied software development based on Android operation systemAfter completing barrage data, often directly by the barrage data distributing of building to client, and client is receiving barrageWhen data, and parsing and distribution processor directly are carried out to barrage data.
As it can be seen that server and client side is not to barrage in existing barrage data distributing process and receive processData carry out any verification, to barrage testing process will be caused mistake occur, very when barrage data are there are when abnormal conditionsTo leading to problems such as client system crash occur, barrage testing efficiency has been seriously affected.
Summary of the invention
The embodiment of the invention provides method of calibration, device, terminal and the storage mediums of a kind of barrage data, to barrageData carry out completeness check and avoid result in client to guarantee that barrage data can be normally resolved and system crash occurThe problems such as.
In a first aspect, the embodiment of the invention provides a kind of methods of calibration of barrage data, comprising:
Obtain the target barrage data of preset characters string structure;
The character in the barrage data object for storing the target barrage data is called to verify function, to the target barrageThe first character and ultimate character in data carry out character verifying;
If character is proved to be successful, the string segmentation function in the barrage data object is called, by the target bulletCurtain data are split with default identifier, determine character string dimension;
According to the array length of the character string dimension, the default identifier quantity in the target barrage data is determined,And when the default identifier quantity meets default verification condition, the target barrage data check success is determined.
Second aspect, the embodiment of the invention also provides a kind of calibration equipments of barrage data, comprising:
Target barrage data acquisition module, for obtaining the target barrage data of preset characters string structure;
Character authentication module, for calling the character in the barrage data object for storing the target barrage data to verify letterNumber, in the target barrage data the first character and ultimate character carry out character verifying;
Character string dimension determining module calls the character in the barrage data object if being proved to be successful for characterThe target barrage data are split with default identifier, determine character string dimension by string segmentation function;
Default identifier quantity correction verification module determines the target for the array length according to the character string dimensionDefault identifier quantity in barrage data, and when the default identifier quantity meets default verification condition, described in determinationThe success of target barrage data check.
The third aspect, the embodiment of the invention also provides a kind of terminal, the terminal includes:
One or more processors;
Memory, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processingDevice realizes the method for calibration such as barrage data provided by any embodiment of the invention.
Fourth aspect, the embodiment of the invention also provides a kind of computer readable storage mediums, are stored thereon with computerProgram realizes the method for calibration such as barrage data provided by any embodiment of the invention when the program is executed by processor.
The embodiment of the present invention is adjusted by storing the target barrage data of preset characters string structure to barrage data objectWith in barrage data object character verify function, in target barrage data the first character and ultimate character carry out character testCard;If character is proved to be successful, the string segmentation function in barrage data object is called, by target barrage data to be marked in advanceKnow symbol to be split, determines character string dimension;According to the array length of character string dimension, determine default in target barrage dataIdentifier quantity, and when default identifier quantity meets default verification condition, determine the success of target barrage data check.Pass throughBy adopting the above technical scheme, completeness check has been carried out to the target barrage data of preset characters string structure, thus in target bulletAfter curtain data check success, target barrage data can normally be parsed, and then avoid and led because of barrage data exceptionIt causes client the problems such as system crash occur, improves barrage testing efficiency.
Detailed description of the invention
Fig. 1 is a kind of flow chart of the method for calibration for barrage data that the embodiment of the present invention one provides;
Fig. 2 is a kind of flow chart of the method for calibration of barrage data provided by Embodiment 2 of the present invention;
Fig. 3 is a kind of structural schematic diagram of the calibration equipment for barrage data that the embodiment of the present invention three provides;
Fig. 4 is a kind of structural schematic diagram for terminal that the embodiment of the present invention four provides.
Specific embodiment
The present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouchedThe specific embodiment stated is used only for explaining the present invention rather than limiting the invention.It also should be noted that in order to justOnly the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
Embodiment one
Fig. 1 is a kind of flow chart of the method for calibration for barrage data that the embodiment of the present invention one provides, and the present embodiment can fitThe case where carrying out completeness check for the barrage data to preset characters string structure, it is particularly possible to for root in barrage serverAfter generating barrage data according to default barrage agreement, in the application scenarios that are verified to the barrage data of generation, while can also be withIn application scenarios for being verified in Android client to the barrage data that barrage server issues.This method can be withIt is executed by the calibration equipment of barrage data, which can be realized by the mode of software and/or hardware, can be integrated in barrageServer is equipped in the terminal with barrage function of android system, such as smart phone, tablet computer, intelligenceThe intelligent terminals such as TV or laptop.This method specifically includes the following steps:
S110, the target barrage data for obtaining preset characters string structure.
Wherein, barrage data can refer to barrage parameter information is packaged according to default barrage agreement after the word that obtainsThe data of symbol string String type.Default barrage agreement can be preset with user demand according to the actual situation, be used forThe transmission data structure for providing barrage data, so as to can carry out data transmission between barrage server and client.Default bulletCurtain agreement can specify that one or more data structures.Preset characters string structure can be one kind specified in default barrage agreementData structure.Preset characters string structure is corresponding with default barrage agreement.Target barrage data can refer to be verified presetThe barrage data of character string structure.
Optionally, preset characters string structure are as follows: using default first symbol as the first character, each key is divided with default separatorValue is to information, to preset key information and value information in connector connection key-value pair information, using default end mark as last bit wordSymbol, wherein value information does not include default connector.
Wherein, presetting first symbol, default separator, default connector and default end mark is previously according to actual conditionsThe character of setting, and default first symbol, default separator, default connector and default end mark are mutually different characters.The quantity for the preset characters that default separator or default connector in the present embodiment include can be one, or moreIt is a.Wherein, preset characters can be a kind of number, letter or additional character predetermined etc..Illustratively, first symbol is presetCan be but be not limited to left brace " ", left round parentheses " (" and left bracket " [".In order to increase and key-value pair information contentBetween discrimination, preferably left brace " ".Default separator can be but not limited to slash " " and "/".Default connectionSymbol can be but not limited to "-", " ", ", " "==" and "=", default end mark can be but not limited to right brace " ",Right round parentheses ") " and right bracket "] ", preferably right brace " ".
It specifically, include multiple between the first character and ultimate character in the target barrage data of preset characters string structureKey-value pair information is divided between every two key-value pair information, the key information in each key-value pair information with default separatorIt is attached with value information with default connector, and does not include default connector in each value information.In the present embodimentKey-value pair information may include English character and/or Chinese character.The present embodiment believes key-value pair in preset characters string structureThe quantity of breath is without limitation.Illustratively, the target barrage data of preset characters string structure can be with are as follows:
{@=0/ type@=uenter/rid@=104838/uid@=20080138/wgei }
Wherein, target barrage data with " " be default first symbol, be default separator with "/", be default connect with "@="Symbol is connect, with " " it is default end mark, including four key-value pair informations.Key information in first key-value pair information is " type ", rightThe value information answered is " uenter ";Key information in second key-value pair information is " rid ", and corresponding value information is " 104838 ";Key information in third key-value pair information is " uid ", and corresponding value information is " 20080138 ";Key in 4th key-value pair informationInformation is " wgei ", and corresponding value information is " 0 ".
Optionally, S110 includes: to obtain barrage data to be verified and the corresponding data to be verified of barrage data to be verifiedMark;Data Identification in Data Identification to be verified logo collection corresponding with preset characters string structure is matched;IfWith success, then barrage data to be verified are determined as target barrage data.
Wherein, barrage data to be verified can be barrage parameter information is packaged according to default barrage agreement after obtainAny character string structure barrage data.Each barrage data to be verified correspond to a Data Identification to be verified.It is to be verifiedData Identification is used to carry out unique identification to barrage data to be verified, can determine bullet to be verified by Data Identification to be verifiedThe data structure of curtain data.The corresponding logo collection of preset characters string structure may include: that data structure is preset characters string knotThe corresponding Data Identification of all barrage data of structure.
It specifically,, can be pre- when generating some barrage data if default barrage agreement defines plurality of data structuresWhether the data structure for first detecting the barrage data of generation is preset characters string structure, if so, the barrage data are correspondingData Identification is added in the corresponding logo collection of preset characters string structure, to be preset characters string by the data structure of generationThe corresponding Data Identification of barrage data of structure is added in the logo collection, to carry out subsequent verification operation.It is obtainingIt, can be by Data Identification to be verified and preset characters string structure pair after taking the corresponding Data Identification to be verified of barrage data to be verifiedThe Data Identification in logo collection answered is matched one by one, if any data mark in Data Identification to be verified and logo collectionKnow successful match, then shows that the data structure of the barrage data to be verified is preset characters string structure, this can be waited for into school at this timeIt tests barrage data and is determined as target barrage data, to carry out completeness check to target barrage data.If data mark to be verifiedIt fails to match with each Data Identification in logo collection for knowledge, then shows that the data structure of the barrage data to be verified is not pre-If character string structure, next barrage data to be verified available at this time are simultaneously identified matching, until obtaining preset characters stringThe target barrage data of structure.
S120, the character in the barrage data object of storage target barrage data is called to verify function, to target barrage numberThe first character and ultimate character in carry out character verifying.
Wherein, barrage data object is one for storing the object of target barrage data.Target bullet in the present embodimentCurtain data are the data of a String type, so that barrage data object is a String object.Character verifies function canBe it is predetermined, for the first character and the function verified of ultimate character in target barrage data.
Optionally, character verifying function is achieved by the steps of to the first character and last bit word in target barrage dataSymbol carry out character verifying function: call the first character verify function, detect target barrage data in the first character whether beDefault first symbol;If the first character is default first symbol, the second character is called to verify function, detected in target barrage dataWhether ultimate character is default end mark;If ultimate character is default end mark, it is determined that character is proved to be successful.
Wherein, the first character verifying function is predetermined, for carrying out to the first character in target barrage dataThe function of verification.Second character verifying function be it is predetermined, for carrying out school to the ultimate character in target barrage dataThe function tested.Illustratively, barrage data object is labeled as danmuStr, if default first symbol be " ", default end mark is" ", then call the first character verifying function to can be danmuStr.startWith (" { "), to detect barrage data objectThe first character in target barrage data in danmuStr whether be " ";Second character verifies functionDanmuStr.endWith (" "), to detect the ultimate character in the target barrage data in barrage data object danmuStrWhether be " ".
Specifically, after calling the first character verifying function, if the first character in detection target barrage data is not pre-If first symbol, then show the first character authentication failed, that is, target barrage data are an incomplete data, i.e., it is unqualifiedData can directly determine the failure of target barrage data check at this time.If the first character detected in target barrage data is pre-If first symbol, then show that the first character is proved to be successful, the second character can be called to verify function at this time, detects target barrage dataIn ultimate character whether be default end mark, if so, showing that the first character in target barrage data and ultimate character are equalBe it is legal, can determine that character is proved to be successful at this time;If it is not, then show that target barrage data are an incomplete data,The failure of target barrage data check can be directly determined at this time.
If S130, character are proved to be successful, the string segmentation function in barrage data object is called, by target barrage numberIdentifier is preset accordingly to be split, and determines character string dimension.
Wherein, string segmentation function is predetermined, for target barrage data to be split into character string numberThe function of group.Illustratively, if barrage data object is labeled as danmuStr, the string segmentation in barrage data objectFunction can be with are as follows: danmuStr.split (), so as to the target barrage number that will be stored in barrage data object danmuStrAccording to being divided into a character string dimension.Default identifier may include a preset characters, also may include multiple preset characters.A kind of default identifier can be set in the present embodiment, and a variety of default identifiers also can be set.Default identifier can be according to pre-If preset characters string structure as defined in barrage agreement predefines.Default identifier can include but is not limited to default separator andDefault connector.
Specifically, the present embodiment can call character to preset identifier as the input parameter of string segmentation functionTarget barrage data in barrage data object are split with default identifier, and will obtained after segmentation by string segmentation functionMultiple string datas constitute character string dimension.Illustratively, it is assumed that the target stored in barrage data object danmuStrBarrage data are as follows: adbcebde, preset identifier be b, then by call splitSrtArray=danmuStr.split ("B "), target barrage data are stored with the string data that b is split acquisition into character string dimension splitSrtArray,That is the information in splitSrtArray are as follows: { " ad ", " ce ", " de " }.
S140, the array length according to character string dimension, determine the default identifier quantity in target barrage data, andWhen default identifier quantity meets default verification condition, the success of target barrage data check is determined.
Wherein, the array length of character string dimension refers to the element number in character string dimension.Default verification condition refers toWhen barrage data are complete, the condition that identifier quantity needs to meet is preset.Illustratively, if obtaining some target bullet in advanceThe accurate quantity that identifier is preset in curtain data is 10, then presetting verification condition can be with are as follows: mark is preset in target barrage dataThe quantity of symbol is 10.
Specifically, the present embodiment can directly acquire the array of character string dimension according to the length attribute of character string dimensionLength, that is, the number of the string data after dividing.Illustratively, it by calling splitSrtArray.length, can obtainObtain the array length of character string dimension splitSrtArray.For accurate complete target barrage data, target barrage numberThe first character and ultimate character in will not be default identifiers, and each of target barrage data preset identifierFront and back there is a string data, thus segmentation after string data quantity 1 more than default identifier quantity, becauseThis result that can subtract 1 for the array length of character string dimension and obtain is determined as default identifier quantity.Determining preset charactersAfter quantity, examine whether default identifier quantity meets default test condition, if satisfied, then showing that target barrage data are oneComplete accurate data can be normally resolved, and can determine the success of target barrage data check at this time.If not satisfied, then tableImproving eyesight mark barrage data are an invalid datas, determine the failure of target barrage data check at this time.
The present embodiment is when determining default identifier quantity, by being divided target barrage data to preset identifierIt cuts, default identifier quantity can be determined according to the quantity of the string data after segmentation, without will be in target barrage dataEach character is matched or is looped through one by one matching with default identifier, thus when target barrage data are larger, it canTo quickly determine the default identifier quantity in target barrage data, calculating speed is substantially increased, and then improve barrageThe verification efficiency of data.
It should be noted that function provided by step S120-S140 can be packaged as a bullet by the present embodimentCurtain verification function, thus only need to be using barrage data object as the input object of barrage verification function, by calling barrage verificationThe checking procedure of target barrage data can be realized in function, so that barrage verification is more convenient.Illustratively, barrage verifies letterNumber can be with is defined as: Publis static BooleancheckDanmInfo (String danmuStr).Wherein,CheckDanmInfo is the function name of barrage verification function, and danmuStr is the barrage data pair of character string String typeAs the return value of barrage verification function checkDanmInfo is the object of boolean's Boolean type.If target barrage numberAccording to verifying successfully, then barrage verification function checkDanmInfo can be by calling return true to return to true, if targetThe failure of barrage data check, then barrage verification function checkDanmInfo can call return false to return to false.BulletCurtain verification function checkDanmInfo has public permission modifier public and static types modifier static, in order toDirectly to call checkDanmInfo by class, the convenience of barrage verification function call is improved.
Optionally, before issuing target barrage data to Android client in barrage server, it can use this implementationThe method of calibration of barrage data provided by example is verified, and after the success of target barrage data check, then carries out target bulletCurtain data issue operation, to guarantee that the target barrage data that barrage server issues are accurate complete data.Android visitorAfter family terminates the target barrage data for accepting hair, the method for calibration that can use barrage data provided by the present embodiment is carried out againSecondary verification, and target barrage data check success after, then to target barrage data carry out dissection process, so as to avoid becauseBarrage data exception and lead to problems such as client system crash occur, improve barrage testing efficiency.
The target barrage data of preset characters string structure are stored in barrage data object by the technical solution of the present embodimentAfterwards, call barrage data object in character verify function, in target barrage data the first character and ultimate character carry outCharacter verifying;If character is proved to be successful, the character string transfer function in barrage data object is called, target barrage data are turnedIt is changed to target character array;And the adjacent character element of preset quantity every in target character array is subjected to character splicing, reallyFixed each splicing character string object;By calling the identifier in each splicing character string object to search function respectively, target bullet is determinedThe quantity of identifier is preset in curtain data;When the quantity of default identifier meets default verification condition, target barrage number is determinedAccording to verifying successfully.By using above-mentioned technical proposal, integrality school has been carried out to the target barrage data of preset characters string structureIt tests, to can normally be parsed to target barrage data, and then avoid because of bullet after the success of target barrage data checkCurtain data exception and lead to problems such as client system crash occur, improve barrage testing efficiency.
Embodiment two
Fig. 2 is a kind of flow chart of the method for calibration of barrage data provided by Embodiment 2 of the present invention, and the present embodiment is upperIt states on the basis of embodiment to " the string segmentation function in barrage data object being called, by target barrage data to be marked in advanceKnow symbol to be split, determine character string dimension " it is optimized, and on this basis, also further to " according to character string dimensionArray length, determine the default identifier quantity in target barrage data, and meet default verification in default identifier quantityWhen condition, the success of target barrage data check is determined " it is optimized.Wherein term identical or corresponding with the various embodiments described aboveExplanation details are not described herein.
Referring to fig. 2, barrage data provided in this embodiment method of calibration the following steps are included:
S210, the target barrage data for obtaining preset characters string structure.
Wherein, the preset characters string structure in the present embodiment are as follows: using default first symbol as the first character, separated with defaultSymbol divides each key-value pair information, to preset key information and value information in connector connection key-value pair information, to preset end markAs ultimate character, wherein value information does not include default connector.In this embodiment, presetting identifier includes default separatorWith default connector, and default separator and default connector may each comprise one or more preset characters.Illustratively,Default separator can be but not limited to "/";Default connector can be but not limited to "=".
S220, the character in the barrage data object of storage target barrage data is called to verify function, to target barrage numberThe first character and ultimate character in carry out character verifying.
If S230, character are proved to be successful, using default separator as function input parameters, call in barrage data objectTarget barrage data are split with default separator, determine the first character string dimension by string segmentation function.
Specifically, the present embodiment calls character string segmentation function, by barrage using default separator as function input parametersTarget barrage data in data object are split with default separator, and the string data after segmentation is constituted the first wordSymbol string array.Illustratively, if the target barrage data stored in barrage data object danmuStr are as follows: type@=@=0/ uenter/rid@=104838/uid@=20080138/wgei }, presetting separator is "/", then passes through callingSplitSrtArray1=danmuStr.split ("/"), target barrage data are split to the character string of acquisition with "/"Data are stored into the first character string dimension splitSrtArray1, i.e. information in splitSrtArray1 are as follows: " type@=Uenter ", "@=104838 rid ", "@=20080138 uid ", "@=0 wgei ", " ".
S240, using default connector as function input parameters, call the string segmentation function in barrage data object, willTarget barrage data are split with default connector, determine the second character string dimension.
Specifically, the present embodiment calls character string segmentation function, by barrage using default connector as function input parametersTarget barrage data in data object are split with default connector, and the string data after segmentation is constituted the second wordSymbol string array.Illustratively, if the target barrage data stored in barrage data object danmuStr are as follows: type@=@=0/ uenter/rid@=104838/uid@=20080138/wgei }, presetting connector is "@=", then passes through callingTarget barrage data, are split the word of acquisition by splitSrtArray1=danmuStr.split ("@=") with "@="Symbol string data is stored into the second character string dimension splitSrtArray2, i.e. information in splitSrtArray2 are as follows:" type ", " uenter/rid " " 104838/uid ", " 20080138/wgei ", "=0/ } " }.
S250, according to the array length of the first character string dimension, determine the default separator quantity in target barrage data,And according to the array length of the second character string dimension, the default connector quantity in target barrage data is determined.
Specifically, the present embodiment can be by calling splitSrtArray1.length to obtain the first character string dimensionThe array length of splitSrtArray1, by calling splitSrtArray2.length to obtain the second character string dimensionThe array length of splitSrtArray2.Due to character string dimension array length than default identifier quantity more than 1, thus willThe result that the array length of first character string dimension subtracts 1 and obtains is determined as default separator quantity;By the second character string dimensionThe result that array length subtracts 1 and obtains is determined as default connector quantity.
It should be noted that the present embodiment determined by segmentation object barrage data in the way of default separator quantity withWhen default connector quantity, without limiting the preset characters quantity preset separator and default connector and include, that is to say, that pre-If no matter separator or default connector include several preset characters, the technical solution that can use the present embodiment is rapidly trueDefault separator quantity and default connector quantity in the barrage data that set the goal, substantially increase calculating speed.
If S260, default separator quantity are equal with default connector quantity, it is determined that the success of target barrage data check.
Wherein, when default identifier includes default separator and default connector, by preset characters string structureAnalysis, it can be deduced that: if target barrage array complete and accurate, default separator quantity is equal with default connector quantity, i.e.,Default verification condition are as follows: the quantity of default separator is equal to the quantity of default connector.
Specifically, if default separator quantity is equal with default connector quantity, show to meet default verification condition, thisWhen can determine target barrage data check success.It, can be with if default separator quantity and default connector quantity are unequalDetermine that target barrage data check fails.
The technical solution of the present embodiment, by carrying out target barrage data to preset separator and default connector respectivelyString segmentation, so as to quickly determine default separator quantity and default connector quantity, and by comparing defaultThe separator quantity check results to determine target barrage data whether equal with default connector quantity, so that barrage verification is moreIt is convenient to add.
Based on the above technical solution, barrage number is called using default separator as function input parameters in S230Before the string segmentation function in object, it can also include: that the character in barrage data object is called to extract function, extractCharacter information in target barrage data between the first character and ultimate character, and the character information extracted is determined as firstBarrage data;Target barrage data in barrage data object are updated to the first barrage data;Correspondingly, S230 include: withDefault separator is function input parameters, calls the string segmentation function in barrage data object, by the first barrage data withDefault separator is split, and determines the first character string dimension;S240 includes: to adjust using default connector as function input parametersWith the string segmentation function in barrage data object, the first barrage data are split with default connector, determine secondCharacter string dimension.
Wherein, character extraction function can be predetermined, for extracting the first character and end in target barrage dataThe function of character information between the character of position.Illustratively, by calling the character in barrage data object danmuStr to extractFunction danmuStr.substring (1, length-1), wherein length is the character length in target barrage data, thusCharacter information in available target barrage data between the first character and ultimate character.
Specifically, the present embodiment shows that the first character in target barrage data is default opens after character is proved to be successfulBegin symbol, and ultimate character is default end mark, thus only need to in target barrage data default first symbol and default end mark itBetween character information, i.e. the first barrage data carry out further verify, with further promotions verification efficiency.By by barrageTarget barrage data in data object are updated to the first barrage data, thus calling the character string in barrage data object pointWhen cutting function, the first barrage data that barrage data object can be stored are carried out respectively with default separator and default connectorSegmentation, determines the first character string dimension and the second character string dimension.
It should be noted that the first character for accurate complete first barrage data, in the first barrage dataIt is unlikely to be default separator or default connector, and the ultimate character in the first barrage data is default separator, thusAfter being split to the first barrage data for not including default first symbol and default end mark, the first determining character string dimensionArray length can accurately reflect default separator quantity, it can be determined directly as the array length of the first character arrayDefault separator quantity, the result for subtracting 1 for the array length of the second character array and obtaining are determined as default connector quantity.
Based on the above technical solution, it after default separator quantity is equal with default connector quantity, also wrapsIt includes: each string elements in the first character string dimension is stored into string;It is defeated as function using default connectorEnter parameter, call the string segmentation function in each string, each string elements are carried out with default connectorSegmentation, determines each character string subnumber group;The sub- array length of each character string subnumber group is obtained, and is in each sub- array lengthWhen preset length, the success of target barrage data check is determined.
Wherein, each string elements in the first character string dimension correspond to a string.For complete quasi-For true target barrage data, each string elements in the first character string dimension of acquisition are a key-value pair letterBreath, wherein key information and value information are attached with default connector, and do not include default connector in value information.Default lengthIt spends and refers to when target barrage data are complete, the corresponding sub- array length of character string subnumber group.The present embodiment is in target barrage numberAccording to it is complete when, character string subnumber group includes two character elements, respectively key information and value information, so that preset length can be setIt is set to 2.
Specifically, by preset connector as function input parameters, calling the character string point in each stringFunction is cut, the string elements that each string stores are split with default connector, determines each character stringArray.Illustratively, if some string elements in the first character string dimension are as follows:@=104838 rid, default connector are"@=" then stores the string elements into string danmuStr1, and by calling splitSrtArray11=DanmuStr1.split ("@="), which is stored with the string data that "@=" is split acquisition to wordIn symbol string subnumber group splitSrtArray11, i.e. information in splitSrtArray11 are as follows: [' rid ', ' 104838 '].
It, can be by calling splitSrtArray11.length to obtain each word after determining each character string subnumber groupThe sub- array length of symbol string subnumber group splitSrtArray11, and by comparing the sub- array length of each character string subnumber groupIt whether is preset length, to determine the check results of barrage data.If the sub- array length of all character string subnumber groups isPreset length then shows that the data in target barrage data between every two adjacent default separator are a complete keyValue includes a key information and a value information, can determine the success of target barrage data check at this time to information.If it existsThe sub- array length of at least one character string subnumber group is not equal to preset length, then shows there are incomplete key-value pair information,Barrage parameter information i.e. in target barrage data is imperfect, can determine that target barrage data check fails at this time.This implementationExample is by after default separator quantity is equal with default connector quantity, further to the key-value pair in target barrage dataInformation carries out completeness check, to may be implemented to target barrage data more in the lower situation of system performance requirementsIt verifies to stringency, to be further ensured that the integrality of barrage data.
Embodiment three
Fig. 3 is a kind of structural schematic diagram of the calibration equipment for barrage data that the embodiment of the present invention three provides, the present embodimentIt is applicable to the case where completeness check is carried out to the barrage data of preset characters string structure, which can specifically include: meshMark barrage data acquisition module 310, character authentication module 320, character string dimension determining module 330 and default identifier quantity schoolTest module 340.
Wherein, target barrage data acquisition module 310, for obtaining the target barrage data of preset characters string structure;WordAuthentication module 320 is accorded with, the character in barrage data object for calling storage target barrage data verifies function, to target bulletThe first character and ultimate character in curtain data carry out character verifying;Character string dimension determining module 330, if being verified for characterSuccess, then call the string segmentation function in barrage data object, and target barrage data are split with default identifier,Determine character string dimension;Default identifier quantity correction verification module 340, for the array length according to character string dimension, determines meshThe default identifier quantity in barrage data is marked, and when default identifier quantity meets default verification condition, determines target bulletCurtain data check success.
The technical solution of the embodiment of the present invention, by storing the target barrage data of preset characters string structure to barrage numberAfter object, the character in barrage data object is called to verify function, to the first character and last bit word in target barrage dataSymbol carries out character verifying;If character is proved to be successful, the string segmentation function in barrage data object is called, by target barrageData are split with default identifier, determine character string dimension;According to the array length of character string dimension, target barrage is determinedDefault identifier quantity in data, and when default identifier quantity meets default verification condition, determine target barrage dataIt verifies successfully.By using above-mentioned technical proposal, completeness check has been carried out to the target barrage data of preset characters string structure,To can normally be parsed to target barrage data, and then avoid because of barrage after the success of target barrage data checkData exception and lead to problems such as client system crash occur, improve barrage testing efficiency.
Optionally, preset characters string structure are as follows: using default first symbol as the first character, each key is divided with default separatorValue is to information, to preset key information and value information in connector connection key-value pair information, using default end mark as last bit wordSymbol, wherein value information does not include default connector.
Optionally, target barrage data acquisition module 310, is specifically used for:
Obtain barrage data to be verified and the corresponding Data Identification to be verified of barrage data to be verified;
Data Identification in Data Identification to be verified logo collection corresponding with preset characters string structure is matched;
If successful match, barrage data to be verified are determined as target barrage data.
Optionally, character authentication module 320 includes that character verifies function execution unit, for being achieved by the steps of pairThe first character and ultimate character in target barrage data carry out the function of character verifying:
It calls the first character to verify function, detects whether the first character in target barrage data is default first symbol;
If the first character is default first symbol, the second character is called to verify function, detects the end in target barrage dataWhether position character is default end mark;
If ultimate character is default end mark, it is determined that character is proved to be successful.
Optionally, character string dimension determining module 330, is specifically used for:
Using default separator as function input parameters, the string segmentation function in barrage data object is called, by targetBarrage data are split with default separator, determine the first character string dimension;
Using default connector as function input parameters, the string segmentation function in barrage data object is called, by targetBarrage data are split with default connector, determine the second character string dimension.
Optionally, identifier quantity correction verification module 340 is preset, is specifically used for:
According to the array length of the first character string dimension, the default separator quantity in target barrage data, and root are determinedAccording to the array length of the second character string dimension, the default connector quantity in target barrage data is determined;
If default separator quantity is equal with default connector quantity, it is determined that the success of target barrage data check.
Optionally, the device further include:
String elements memory module, for after default separator quantity is equal with default connector quantity, by theEach string elements in one character string dimension are stored into string;
Character string subnumber group determining module, for calling each character string pair using default connector as function input parametersEach string elements are split with default connector, determine each character string subnumber group by the string segmentation function as in;
Sub- array length calibration mode is fast, for obtaining the sub- array length of each character string subnumber group, and in each subnumber groupWhen length is preset length, the success of target barrage data check is determined.
The calibration equipment of barrage data provided by the embodiment of the present invention can be performed provided by any embodiment of the inventionThe method of calibration of barrage data has the corresponding functional module of method of calibration and beneficial effect for executing barrage data.
It is worth noting that, in the embodiment of the calibration equipment of above-mentioned barrage data, included each unit and moduleIt is only divided according to the functional logic, but is not limited to the above division, as long as corresponding functions can be realized;In addition, the specific name of each functional unit is also only for convenience of distinguishing each other, the protection scope being not intended to restrict the invention.
Example IV
Fig. 4 is a kind of structural schematic diagram for terminal that the embodiment of the present invention four provides.Referring to fig. 4, which includes:
One or more processors 410;
Memory 420, for storing one or more programs;
When one or more programs are executed by one or more processors 410, so that one or more processors 410 are realizedAs in above-described embodiment any embodiment propose barrage data method of calibration, this method comprises:
Obtain the target barrage data of preset characters string structure;
The character in the barrage data object of storage target barrage data is called to verify function, in target barrage dataThe first character and ultimate character carry out character verifying;
If character is proved to be successful, call the string segmentation function in barrage data object, by target barrage data withDefault identifier is split, and determines character string dimension;
According to the array length of character string dimension, the default identifier quantity in target barrage data is determined, and defaultWhen identifier quantity meets default verification condition, the success of target barrage data check is determined.
In Fig. 4 by taking a processor 410 as an example;Processor 410 and memory 420 in terminal can by bus or itsHe connects mode, in Fig. 4 for being connected by bus.
Memory 420 is used as a kind of computer readable storage medium, can be used for storing software program, journey can be performed in computerSequence and module, if the corresponding program instruction/module of the method for calibration of the barrage data in the embodiment of the present invention is (for example, barrageTarget barrage data acquisition module 310 in the calibration equipment of data, character authentication module 320, character string dimension determining module330 and default identifier quantity correction verification module 340).Processor 410 by operation be stored in memory 420 software program,Instruction and module thereby executing the various function application and data processing of terminal realize the school of above-mentioned barrage dataProved recipe method.
Memory 420 mainly includes storing program area and storage data area, wherein storing program area can store operation systemApplication program needed for system, at least one function;Storage data area, which can be stored, uses created data etc. according to terminal.ThisOutside, memory 420 may include high-speed random access memory, can also include nonvolatile memory, for example, at least oneDisk memory, flush memory device or other non-volatile solid state memory parts.In some instances, memory 420 can be into oneStep includes the memory remotely located relative to processor 410, these remote memories can pass through network connection to terminal.OnThe example for stating network includes but is not limited to internet, intranet, local area network, mobile radio communication and combinations thereof.
The method of calibration for the barrage data that the terminal and above-described embodiment that the present embodiment proposes propose belongs to same invention structureThink, the technical detail of detailed description not can be found in above-described embodiment in the present embodiment, and the present embodiment has execution barrageThe identical beneficial effect of the method for calibration of data.
Embodiment five
The present embodiment five provides a kind of computer readable storage medium, is stored thereon with computer program, the program quiltThe method of calibration such as barrage data provided by any embodiment of the invention is realized when processor executes, this method comprises:
Obtain the target barrage data of preset characters string structure;
The character in the barrage data object of storage target barrage data is called to verify function, in target barrage dataThe first character and ultimate character carry out character verifying;
If character is proved to be successful, call the string segmentation function in barrage data object, by target barrage data withDefault identifier is split, and determines character string dimension;
According to the array length of character string dimension, the default identifier quantity in target barrage data is determined, and defaultWhen identifier quantity meets default verification condition, the success of target barrage data check is determined.
The computer storage medium of the embodiment of the present invention, can be using any of one or more computer-readable mediaCombination.Computer-readable medium can be computer-readable signal media or computer readable storage medium.It is computer-readableStorage medium can be for example but not limited to: electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, orAny above combination of person.The more specifically example (non exhaustive list) of computer readable storage medium includes: with oneOr the electrical connections of multiple conducting wires, portable computer diskette, hard disk, random access memory (RAM), read-only memory (ROM),Erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), lightMemory device, magnetic memory device or above-mentioned any appropriate combination.In this document, computer readable storage medium canWith to be any include or the tangible medium of storage program, the program can be commanded execution system, device or device use orPerson is in connection.
Computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal,Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimitedIn electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer canAny computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used forBy the use of instruction execution system, device or device or program in connection.
The program code for including on computer-readable medium can transmit with any suitable medium, including but not limited to:Wirelessly, electric wire, optical cable, RF etc. or above-mentioned any appropriate combination.
The computer for executing operation of the present invention can be write with one or more programming languages or combinations thereofProgram code, described program design language include object oriented program language, such as Java, Smalltalk, C++, alsoIncluding conventional procedural programming language-such as " C " language or similar programming language.Program code can be completeIt executes, partly executed on the user computer on the user computer entirely, being executed as an independent software package, partPart executes on the remote computer or executes on a remote computer or server completely on the user computer.It is relating toAnd in the situation of remote computer, remote computer can pass through the network of any kind, including local area network (LAN) or wide area network(WAN), it is connected to subscriber computer, or, it may be connected to outer computer (such as led to using ISPCross internet connection).
Will be appreciated by those skilled in the art that each module of the above invention or each step can use general meterDevice is calculated to realize, they can be concentrated on single computing device, or be distributed in network constituted by multiple computing devicesOn, optionally, they can be realized with the program code that computer installation can be performed, so as to be stored in storageIt is performed by computing device in device, perhaps they are fabricated to each integrated circuit modules or will be more in themA module or step are fabricated to single integrated circuit module to realize.In this way, the present invention is not limited to any specific hardware andThe combination of software.
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art thatThe invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation,It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present inventionIt is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, alsoIt may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.