CN108430045A - A kind of character string pruning method and device - Google Patents
A kind of character string pruning method and device Download PDFInfo
- Publication number
- CN108430045A CN108430045A CN201810209329.7A CN201810209329A CN108430045A CN 108430045 A CN108430045 A CN 108430045A CN 201810209329 A CN201810209329 A CN 201810209329A CN 108430045 A CN108430045 A CN 108430045A
- Authority
- CN
- China
- Prior art keywords
- accounting
- expression
- charging
- searching
- character
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 35
- 238000013138 pruning Methods 0.000 title claims abstract description 23
- 230000014509 gene expression Effects 0.000 claims abstract description 177
- 238000009966 trimming Methods 0.000 claims abstract description 27
- 238000006243 chemical reaction Methods 0.000 claims abstract description 18
- 238000012216 screening Methods 0.000 claims abstract description 16
- 238000012545 processing Methods 0.000 claims description 10
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000011835 investigation Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/24—Accounting or billing
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/02—Details
- H04L12/14—Charging, metering or billing arrangements for data wireline or wireless communications
- H04L12/1425—Charging, metering or billing arrangements for data wireline or wireless communications involving dedicated fields in the data packet for billing purposes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M15/00—Arrangements for metering, time-control or time indication ; Metering, charging or billing arrangements for voice wireline or wireless communications, e.g. VoIP
- H04M15/41—Billing record details, i.e. parameters, identifiers, structure of call data record [CDR]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M15/00—Arrangements for metering, time-control or time indication ; Metering, charging or billing arrangements for voice wireline or wireless communications, e.g. VoIP
- H04M15/43—Billing software details
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The present invention relates to a kind of character string pruning method and devices.This method includes:Each operation relation symbol in first charging expression formula is replaced with a kind of corresponding character respectively, obtains the second charging expression formula by conversion;Trimming instruction is received, according to preset rules screening and character corresponding with the first book keeping operation relevant operation relation symbol of rate ID logics and the first book keeping operation rate ID in the second charging expression formula is deleted, obtains third charging expression formula;Character corresponding with operation relation symbol in third charging expression formula is subjected to inverse conversion according to preset order, obtains the 4th charging expression formula.By the above-mentioned means, realizing in the case where not influencing entire expression formula logical relation, book keeping operation rate ID to be deleted in charging expression formula can be quickly deleted.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a character string trimming method and device.
Background
Since long distance and roaming requirements have now been eliminated, existing charging schemes still continue to use the previous charging schemes. There is a need for implementations that remove long distance and roaming from billing tariffs. I.e. the sub-billing tariff IDs for long distance and roaming in the tariff expression need to be pruned. For tariff expressions such as:
mut (add (mut (BDp0, BD10), mut (CTp10, CTz10)), mut (MY20, MYb20)), L2f100f), mut (add (L3f30e, GS001), mut (Glx0, Gxl 0)), mut (BDb0, DX10))), because each sub-billing tariff in an expression has a logical relationship with each other, and "or" mut "is required to remove one sub-billing tariff ID in the expression (if the incoming call display: Glx0 needs to be removed, and if the logical relationship of the whole expression is not affected, the logical identifier mut representing the relationship of Glx0 and Gxl 0 and the corresponding parentheses, commas and the like need to be removed, so how to implement the invention becomes a technical problem to be solved.
Disclosure of Invention
In order to solve the technical problem, the invention provides a character string trimming method and a character string trimming device.
In a first aspect, the present invention provides a method for pruning a character string, including:
replacing each operational relation symbol in the first charging expression with a character corresponding to the operational relation symbol respectively to obtain a converted second charging expression;
receiving a pruning instruction, wherein the pruning instruction is used for indicating a first accounting cost ID to be deleted;
screening and deleting all characters corresponding to the operational relationship symbols logically related to the first accounting expense ID in the second accounting expression and the first accounting expense ID according to the trimming instruction and a preset logic rule to obtain a third accounting expression;
and performing reverse conversion on characters corresponding to the operation relation symbols in the third charging expression according to a preset sequence to obtain a fourth charging expression, wherein the first charging expression comprises the operation relation symbols and at least two accounting cost IDs, and the first accounting cost ID is any accounting cost ID in the at least two accounting cost IDs.
The invention has the beneficial effects that: firstly, the operational relationship symbols in the first billing expression are respectively replaced by one character corresponding to the operational relationship symbols, after the accounting charge ID to be deleted is determined according to the received instruction, the first accounting charge ID is firstly identified according to a preset rule, then the characters corresponding to the operational relationship symbols which are logically related to the first accounting charge ID in the second billing expression and the second accounting charge ID are screened and deleted according to the preset rule, and then the third billing expression is obtained. And inversely converting the third charging expression into a fourth charging expression according to the preset sequence, wherein the expression form of the fourth charging expression is the charging expression obtained by deleting the first accounting cost ID and the logic relation logically related to the first accounting cost ID from the first charging expression. By the method, the accounting charge ID to be deleted in the charging expression can be deleted quickly without influencing the logic relation of the whole expression.
In a second aspect, the present invention provides a character string trimming apparatus, comprising: the conversion unit is used for replacing each operation relation symbol in the first charging expression with a character corresponding to the operation relation symbol respectively to obtain a converted second charging expression;
a receiving unit, configured to receive a pruning instruction, where the pruning instruction is used to indicate a first accounting tariff ID to be deleted;
the processing unit is used for screening and deleting all characters corresponding to the operational relationship symbols which are logically related to the first accounting expense ID in the second accounting expression and the first accounting expense ID according to the trimming instruction and a preset logic rule to obtain a third accounting expression;
the conversion unit is further configured to perform inverse conversion on characters corresponding to the operation relation symbols in the third charging expression according to a preset sequence to obtain a fourth charging expression, where the first charging expression includes the operation relation symbols and at least two accounting cost IDs, and the first accounting cost ID is any one of the at least two accounting cost IDs.
The invention has the beneficial effects that: firstly, the operational relationship symbols in the first billing expression are respectively replaced by one character corresponding to the operational relationship symbols, after the accounting charge ID to be deleted is determined according to the received instruction, the first accounting charge ID is firstly identified according to a preset rule, then the characters corresponding to the operational relationship symbols which are logically related to the first accounting charge ID in the second billing expression and the second accounting charge ID are screened and deleted according to the preset rule, and then the third billing expression is obtained. And inversely converting the third charging expression into a fourth charging expression according to the preset sequence, wherein the expression form of the fourth charging expression is the charging expression obtained by deleting the first accounting cost ID and the logic relation logically related to the first accounting cost ID from the first charging expression. By the method, the accounting charge ID to be deleted in the charging expression can be deleted quickly without influencing the logic relation of the whole expression.
Drawings
Fig. 1 is a schematic flow chart of a method for pruning a character string according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of another string pruning method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a character string trimming apparatus according to an embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, interfaces, techniques, etc., in order to provide a thorough understanding of the present invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
Fig. 1 is a schematic flow chart of a method for pruning a character string according to an embodiment of the present invention. As shown in fig. 1, the method includes:
and step 110, replacing each operation relation symbol in the first charging expression with a corresponding character respectively to obtain a converted second charging expression.
Specifically, in the first charging expression, the area to be deleted, including the characters to be deleted and the accounting cost ID, can be easily identified when some accounting cost IDs are deleted by a subsequent system, and the overall logical relationship in the first charging expression is not affected. Therefore, it is possible to replace the operation relation symbol in the first billing expression with a corresponding character, which is recognized by the system and can be easily divided into regions according to the character. And after conversion, acquiring a second charging expression.
Step 120, receiving a pruning instruction, where the pruning instruction is used to indicate the first billing tariff ID to be deleted.
Specifically, the trimming instruction is received, for example, the trimming instruction is input by the user, but may be obtained through other ways. The trim order is then used to indicate the first billing tariff ID to be deleted. And screening and deleting the characters corresponding to the operation relation symbols logically related to the first accounting expense ID in the second accounting expression and the first accounting expense ID according to the trimming instruction in the subsequent steps to obtain a third accounting expression. I.e., step 130.
And step 130, screening and deleting all characters corresponding to the operational relationship symbols logically related to the first accounting cost ID in the second charging expression and the first accounting cost ID according to the trimming instruction and a preset logic rule, and obtaining a third charging expression.
Specifically, according to the trimming instruction, the accounting cost ID to be deleted can be specified, and then according to a certain logic rule, all characters corresponding to the operation relation symbols logically related to the first accounting cost ID in the second charging expression can be screened and deleted. In this way, the third billing expression can be obtained.
And 140, reversely converting the characters corresponding to the operation relation symbols in the third charging expression according to a preset sequence to obtain a fourth charging expression.
Specifically, characters corresponding to the operational relation symbols in the third charging expression are reversely converted according to a preset sequence to obtain a fourth charging expression, wherein the fourth charging expression is the charging expression obtained by deleting the first accounting cost ID to be deleted and the symbols logically associated with the first accounting cost ID in the first charging expression.
The character string trimming method provided by the embodiment of the invention comprises the steps of firstly replacing operational relationship symbols in a first charging expression with corresponding characters respectively, after determining an accounting charge ID to be deleted according to a received instruction, firstly identifying the first accounting charge ID according to a preset rule, then screening and deleting characters corresponding to the operational relationship symbols which are logically related to the first accounting charge ID in a second charging expression and the second accounting charge ID according to the preset rule, and then obtaining a third charging expression. And inversely converting the third charging expression into a fourth charging expression according to the preset sequence, wherein the expression form of the fourth charging expression is the charging expression obtained by deleting the first accounting cost ID and the logic relation logically related to the first accounting cost ID from the first charging expression. By the method, the accounting charge ID to be deleted in the charging expression can be deleted quickly without influencing the logic relation of the whole expression.
Optionally, to describe the character string pruning method provided by the present invention in more detail, on the basis of the foregoing embodiment, an embodiment of the present invention further provides another character string pruning method, specifically as shown in fig. 2, the method may include:
step 210, each operation relation symbol in the first charging expression is replaced by a corresponding character, and a converted second charging expression is obtained.
Specifically, in the first charging expression, the area to be deleted, including the characters to be deleted and the accounting cost ID, can be easily identified when some accounting cost IDs are deleted by a subsequent system, and the overall logical relationship in the first charging expression is not affected. Therefore, it is possible to replace the operation relation symbol in the first billing expression with a corresponding character, which is recognized by the system and can be easily divided into regions according to the character. And after conversion, acquiring a second charging expression.
Step 220, receiving a pruning instruction, wherein the pruning instruction is used for indicating the first accounting cost ID to be deleted.
Specifically, the trimming instruction is received, for example, the trimming instruction is input by the user, but may be obtained through other ways. The trim order is then used to indicate the first billing tariff ID to be deleted. And screening and deleting the characters corresponding to the operation relation symbols logically related to the first accounting expense ID in the second accounting expression and the first accounting expense ID according to the trimming instruction in the subsequent steps to obtain a third accounting expression. I.e., step 230.
And 230, screening and deleting all characters corresponding to the operational relationship symbols logically related to the first accounting expense ID in the second charging expression and the first accounting expense ID according to the trimming instruction and a preset logic rule, and obtaining a third charging expression.
Specifically, in the first charging expression, the symbol representing the operational relationship may include one or more of the following: the symbols representing the operational relationship in the first billing expression are respectively replaced by a character corresponding to the symbols, specifically, the symbols are replaced by a character "|, |", the symbols are replaced by an "add" |, ", the symbols are replaced by a" 1|, "and the symbols are replaced by a" mut "(" 2|, ").
According to the trimming instruction, the accounting charge ID to be deleted can be determined, and then according to a certain logic rule, all characters corresponding to the operation relation symbols which are logically related to the first accounting charge ID in the second charging expression can be screened and deleted. In this way, the third billing expression can be obtained.
The specific execution process may include:
step 2301, find and delete the first accounting cost ID in the second charging expression and the characters most adjacent to the first accounting cost ID.
Step 2302 identifies the symbol in the first billing expression that is closest to the first billing tariff ID.
Step 2303, according to the most similar symbol "and the position relationship between the" and the first accounting cost ID, determining the search direction in the second accounting expression.
Specifically, when the closest symbol "is on the left side of the first accounting cost ID", it is determined that the search direction in the second charging expression is to search to the left starting from the position of the first accounting cost ID.
Or, when the closest symbol "is on the right side of the first accounting cost ID, then the search direction in the second charging expression is determined as searching to the right starting from the first accounting cost ID position.
Step 2304, screening and deleting the remaining characters related to the first billing tariff ID logic in the second billing expression according to the search direction, and acquiring a third billing expression.
Specifically, an initial value of an integer variable i may be set to 1 in advance;
when the searching direction is to start from the first accounting charge ID position, and search to the left, if the character corresponding to the relation is searched, adding 1 to the value of i, and continuing searching; if characters corresponding to other symbols except ")" are found, subtracting 1 from the value of i, continuing to find until i is 0, stopping finding, and deleting all found characters.
Or,
and when the searching direction is to start from the first accounting charge ID position, searching to the right, if the character corresponding to the 'is searched, subtracting 1 from the value i, continuing searching, if the character corresponding to other symbols except' is searched, adding 1 to the value i, continuing searching, and stopping searching when i is 0, and deleting all searched characters.
And 240, reversely converting the characters corresponding to the operation relation symbols in the third charging expression according to a preset sequence to obtain a fourth charging expression.
Specifically, characters corresponding to the operational relation symbols in the third charging expression are reversely converted according to a preset sequence to obtain a fourth charging expression, wherein the fourth charging expression is the charging expression obtained by deleting the first accounting cost ID to be deleted and the symbols logically associated with the first accounting cost ID in the first charging expression.
It should be noted that, in the above method steps, the characters adjacent to the left and right of the first billing cost ID are necessarily characters logically related to the first billing cost ID, and may be directly deleted. This is so as to facilitate subsequent investigation of other characters logically associated with the first billing tariff ID without confusion. However, sometimes one of the characters adjacent to the left and right of the first billing tariff ID is ",". Then, if such a situation occurs, step 2201 may not be performed first. After finding other characters logically related to the first billing tariff ID in the subsequent steps 2202-2204, the characters adjacent to the first billing tariff ID left and right, etc. are deleted at the same time. The purpose of this is to accurately locate the symbol "closest to" the first accounting character ID, and the "corresponding character, for convenience in locating the direction and bounds of the character. That is, step 2101 may be interchanged with step 2202 and step 2203, and may be executed in the order of execution described above, or step 2202 and step 2203 may be executed first, and then step 2201 may be executed. The specific execution sequence may be set according to actual conditions, and is not limited herein.
In step 2404, when looking for left, if looking for ")" the corresponding character, it is obvious that i needs to be added by 1 if the logic related to the first billing tariff ID logic is not finished, and if other characters are encountered, i can be subtracted by 1 until 0. The same reasoning holds, so when looking for to the right, if we encounter ")" the corresponding character, we subtract 1 from i, else we add 1 from 1 until it is 0.
In step 240, the characters corresponding to the operation relation symbols in the third charging expression are reversely converted according to the preset sequence, so as to obtain a fourth charging expression. Specifically, first "|, |" is replaced with ",", and then |3 is replaced with ")", while other symbols, such as "1 |" is replaced with "add (", and "2 |" is replaced with "mut (" the order can be random, without limitation).
In a specific embodiment, for example, the first charging expression is: add (mut (BDp0, BD10), mut (CTp10, CTz 10)). The charging ID to be deleted is CTp 10.
In the first step, all the symbols of the algorithm are replaced by a corresponding character, as described above. The second charging expression obtained after conversion is as follows:
1|2|BDp0|,|BD10|3|,|2|CTp10|,|CTz102|2|。
in a specific implementation process, it can be seen that the rightmost of CTp10 is "the corresponding character" |, | "and the leftmost is" mut ("the corresponding character" 2| ". if the characters on CTp10 and the left and right sides are deleted in the first step, confusion may easily occur. In the above example, it is obvious that when looking up to the right ")" the corresponding character |3, i is already 0 after subtracting 1, which means that the symbol is "| 3" in the second billing expression except for the characters "|, | and 2| adjacent to the CTp10 on the left and right in the second billing expression.
After deleting a few characters, acquiring a third charging expression: 1|2| BDp0|, | BD10|3|, | CTz102|2 |.
Then "|, |" is converted to ",", and then "| 3" is converted to ")", and the remaining characters can be converted in any order.
The fourth charging expression obtained after the final conversion is as follows: add (mut (BDp0, BD10), CTz 10).
By the method, all logic characters related to the first accounting tariff ID logic can be accurately determined and then deleted. Therefore, the accounting charge ID to be deleted in the charging expression can be deleted quickly under the condition of not influencing the logic relation of the whole expression.
Correspondingly to the method embodiment, the embodiment of the invention also provides a structural schematic diagram of the character string trimming device. As shown in fig. 3 in detail, the apparatus includes: a conversion unit 301, a receiving unit 302 and a processing unit 303.
A converting unit 301, configured to replace each operational relationship symbol in the first charging expression with a corresponding character, respectively, to obtain a converted second charging expression.
A receiving unit 302 for receiving a pruning instruction for indicating the first billing tariff ID to be deleted.
And the processing unit 303 is configured to screen and delete the characters corresponding to the operation relationship symbols logically related to the first accounting tariff ID in the second charging expression and the first accounting tariff ID according to the trimming instruction and the preset logic rule, and obtain a third charging expression.
The converting unit 301 is further configured to perform inverse conversion on the characters corresponding to the operation relation symbols in the third charging expression according to a preset sequence, so as to obtain a fourth charging expression, where the first charging expression includes the operation relation symbols and at least two accounting cost IDs, and the first accounting cost ID is any accounting cost ID in the at least two accounting cost IDs.
Optionally, the sign of the operational relationship includes one or more of the following: "," "add (", "mut (" and "), the processing unit 303 is specifically configured to:
searching and deleting the first accounting cost ID in the second charging expression and the characters which are most adjacent to the first accounting cost ID left and right;
identifying a symbol "," in the first charging expression that is closest to the first billing tariff ID;
and determining the searching direction in the second charging expression according to the closest symbol and the position relation between the' and the first accounting tariff ID.
And screening and deleting the characters which are remained in the second charging expression and are logically related to the first accounting tariff ID according to the searching direction to obtain a third charging expression.
Optionally, the processing unit 303 is configured to determine that the search direction in the second charging expression is to search to the left starting from the position of the first accounting cost ID when the closest symbol "is on the left side of the first accounting cost ID.
Or, when the closest symbol "is on the right side of the first accounting cost ID, then the search direction in the second charging expression is determined as searching to the right starting from the first accounting cost ID position.
Optionally, the processing unit 303 is specifically configured to preset an initial value of an integer variable i to be 1;
when the searching direction is to start from the first accounting charge ID position, and search to the left, if the character corresponding to the relation is searched, adding 1 to the value of i, and continuing searching; if characters corresponding to other symbols except ")" are searched, subtracting 1 from the value i, continuing searching until i is 0, stopping searching, and deleting all searched characters;
and when the searching direction is starting from the first accounting charge ID position, searching to the right, if a character corresponding to ', i- -, if characters corresponding to other symbols except', i + +, are searched, and stopping searching until i is 0, and deleting all searched characters.
Optionally, in a specific embodiment, when the sign of the operational relationship includes one or more of the following: "and", "add (", "mut (" and "), conversion unit 301 is specifically configured to replace" with the character "|, |", add ("with the character" 1| "), mut (" with the character "2 |", will ")" and the character "| 3".
The functions performed by the components in the device have been described in detail in the above-mentioned character string pruning method, and are not described again here.
The character string trimming device provided by the embodiment of the invention firstly replaces the operational relationship symbols in the first charging expression with corresponding characters, firstly identifies the first accounting charge ID according to the preset rule after determining the accounting charge ID to be deleted according to the received instruction, then screens and deletes the characters corresponding to the operational relationship symbols which are logically related to the first accounting charge ID in the second charging expression and the second accounting charge ID according to the preset rule, and then obtains the third charging expression. And inversely converting the third charging expression into a fourth charging expression according to the preset sequence, wherein the expression form of the fourth charging expression is the charging expression obtained by deleting the first accounting cost ID and the logic relation logically related to the first accounting cost ID from the first charging expression. By the method, the accounting charge ID to be deleted in the charging expression can be deleted quickly without influencing the logic relation of the whole expression.
Furthermore, an embodiment of the present invention provides a computer-readable storage medium, on which computer program instructions are stored, which when executed by a processor implement the method steps described in any of the above method embodiments.
The reader should understand that in the description of this specification, reference to the description of the terms "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.
Claims (10)
1. A method for string pruning, the method comprising:
replacing each operational relation symbol in the first charging expression with a character corresponding to the operational relation symbol respectively to obtain a converted second charging expression;
receiving a pruning instruction, wherein the pruning instruction is used for indicating a first accounting cost ID to be deleted;
screening and deleting all characters corresponding to the operational relationship symbols logically related to the first accounting expense ID in the second accounting expression and the first accounting expense ID according to the trimming instruction and a preset logic rule to obtain a third accounting expression;
and performing reverse conversion on characters corresponding to the operation relation symbols in the third charging expression according to a preset sequence to obtain a fourth charging expression, wherein the first charging expression comprises the operation relation symbols and at least two accounting cost IDs, and the first accounting cost ID is any accounting cost ID in the at least two accounting cost IDs.
2. The method of claim 1, wherein the operational relationship symbols comprise one or more of the following symbols: "," "add (", "mut (" and "), screening and deleting all characters corresponding to the operational relationship symbols logically related to the first accounting tariff ID in the second charging expression and the first accounting tariff ID according to the trimming instruction and preset logic rules, and acquiring a third charging expression, specifically including:
searching and deleting the first accounting cost ID in the second charging expression and characters adjacent to the first accounting cost ID left and right;
identifying a symbol in the first charging expression that is closest to the first billing tariff ID ",";
determining a searching direction in the second charging expression according to the position relation between the most similar symbol' in the first charging expression and the first accounting tariff ID;
and screening and deleting the characters which are remained in the second billing expression and are related to the first accounting tariff ID logic according to the searching direction to obtain a third billing expression.
3. The method according to claim 2, wherein the determining, according to the location relationship between the closest symbol "and the first billing cost ID, the search direction in the second charging expression specifically includes:
when the closest symbol is positioned on the left side of the first accounting cost ID, determining that the search direction in the second accounting expression is to search to the left by taking the position of the first accounting cost ID as a start;
or, when the closest symbol is "on the right side of the first accounting cost ID", determining that the search direction in the second charging expression is to search to the right starting from the position of the first accounting cost ID.
4. The method as claimed in claim 3, wherein screening and deleting the remaining characters related to the first billing tariff ID logic in the second charging expression according to the search direction, and obtaining a third charging expression specifically comprises:
presetting an initial value of an integer variable i as 1;
when the search direction is to search leftwards by taking the first accounting expense ID position as a starting point, if a character corresponding to the' is searched, adding 1 to the value of i, and continuing searching; if the characters corresponding to other symbols except the ')' are searched, subtracting 1 from the value of i, and continuing to search; stopping searching until the i is 0, and deleting all searched characters;
and when the searching direction is starting from the first accounting charge ID position, searching to the right, if the character corresponding to the 'is searched, subtracting 1 from the value i, continuing searching, if the character corresponding to the other symbols except the' is searched, adding 1 to the value i, continuing searching, and stopping searching and deleting all searched characters when the value i is 0.
5. The method according to any one of claims 2 to 4, wherein when the operational relationship symbols include one or more of the following symbols: when the "is" or "is" and "add (", "is mut (" and "), the replacing of the operation relation symbol in the first charging expression by a corresponding character specifically includes:
will be "replaced with the character" |, | ", will be" add ("replaced with the character" 1| ", will" mut ("replaced with the character" 2| ", will") "and the character" |3 ".
6. A character string trimming apparatus, characterized in that the apparatus comprises:
the conversion unit is used for replacing each operation relation symbol in the first charging expression with a character corresponding to the operation relation symbol respectively to obtain a converted second charging expression;
a receiving unit, configured to receive a pruning instruction, where the pruning instruction is used to indicate a first accounting tariff ID to be deleted;
the processing unit is used for screening and deleting all characters corresponding to the operational relationship symbols which are logically related to the first accounting expense ID in the second accounting expression and the first accounting expense ID according to the trimming instruction and a preset logic rule to obtain a third accounting expression;
the conversion unit is further configured to perform inverse conversion on characters corresponding to the operation relation symbols in the third charging expression according to a preset sequence to obtain a fourth charging expression, where the first charging expression includes the operation relation symbols and at least two accounting cost IDs, and the first accounting cost ID is any one of the at least two accounting cost IDs.
7. The apparatus of claim 6, wherein the operational relationship symbols comprise one or more of the following symbols: "," "add (", "mut (" and "), the processing unit being specifically configured to:
searching and deleting the first accounting cost ID in the second charging expression and characters which are most adjacent to the first accounting cost ID left and right;
identifying a symbol in the first charging expression that is closest to the first billing tariff ID ",";
determining a searching direction in the second charging expression according to the position relation between the most similar symbol and the first accounting tariff ID;
and screening and deleting the characters which are remained in the second billing expression and are related to the first accounting tariff ID logic according to the searching direction to obtain a third billing expression.
8. The apparatus according to claim 7, wherein the processing unit is specifically configured to, when the closest symbol "is to the left of the first accounting tariff ID, determine that the direction of search in the second charging expression is to search to the left starting from the first accounting tariff ID position;
or, when the closest symbol is "on the right side of the first accounting cost ID", determining that the search direction in the second charging expression is to search to the right starting from the position of the first accounting cost ID.
9. The apparatus according to claim 8, wherein the processing unit is specifically configured to preset an initial value of an integer variable i to 1;
when the search direction is to search leftwards by taking the first accounting expense ID position as a starting point, if a character corresponding to the' is searched, adding 1 to the value of i, and continuing searching; if characters corresponding to other symbols except the ')' are searched, subtracting 1 from the value of i, continuing searching until the value of i is 0, stopping searching, and deleting all searched characters;
and when the searching direction is starting from the first accounting charge ID position, searching to the right, if the character corresponding to the 'is searched, subtracting 1 from the value i, continuing searching, if the character corresponding to the other symbols except the' is searched, adding 1 to the value i, continuing searching, and stopping searching and deleting all searched characters when the value i is 0.
10. The apparatus according to any one of claims 7-9, wherein when the sign of the operational relationship comprises one or more of: "," add ("," mut ("and"), the conversion unit is specifically configured to replace "with the character" |, | ", add (" with the character "1 |"), mut ("with the character" 2| ", will") "and the character" |3 ".
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810209329.7A CN108430045B (en) | 2018-03-14 | 2018-03-14 | Character string trimming method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810209329.7A CN108430045B (en) | 2018-03-14 | 2018-03-14 | Character string trimming method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108430045A true CN108430045A (en) | 2018-08-21 |
CN108430045B CN108430045B (en) | 2020-11-24 |
Family
ID=63158473
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810209329.7A Active CN108430045B (en) | 2018-03-14 | 2018-03-14 | Character string trimming method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108430045B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6973639B2 (en) * | 2000-01-25 | 2005-12-06 | Fujitsu Limited | Automatic program generation technology using data structure resolution unit |
US20070025704A1 (en) * | 2005-08-01 | 2007-02-01 | Sony Corporation | Information-processing apparatus, reproduction apparatus, communication method, reproduction method and computer programs |
CN101154238A (en) * | 2006-09-26 | 2008-04-02 | 株式会社东芝 | Apparatus, method for processing information |
CN101807184A (en) * | 2009-02-16 | 2010-08-18 | 阿尔卡特朗讯 | Method for searching character string with wildcard character and system thereof |
CN102446167A (en) * | 2011-08-31 | 2012-05-09 | 中博信息技术研究院有限公司 | Method and device for logically processing complex character string based on logic template |
CN105159758A (en) * | 2015-08-07 | 2015-12-16 | 北京思特奇信息技术股份有限公司 | Relationship object recursion merging calculation method and system |
CN106569986A (en) * | 2015-10-12 | 2017-04-19 | 北京国双科技有限公司 | Character string replacement method and device |
-
2018
- 2018-03-14 CN CN201810209329.7A patent/CN108430045B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6973639B2 (en) * | 2000-01-25 | 2005-12-06 | Fujitsu Limited | Automatic program generation technology using data structure resolution unit |
US20070025704A1 (en) * | 2005-08-01 | 2007-02-01 | Sony Corporation | Information-processing apparatus, reproduction apparatus, communication method, reproduction method and computer programs |
CN101154238A (en) * | 2006-09-26 | 2008-04-02 | 株式会社东芝 | Apparatus, method for processing information |
CN101807184A (en) * | 2009-02-16 | 2010-08-18 | 阿尔卡特朗讯 | Method for searching character string with wildcard character and system thereof |
CN102446167A (en) * | 2011-08-31 | 2012-05-09 | 中博信息技术研究院有限公司 | Method and device for logically processing complex character string based on logic template |
CN105159758A (en) * | 2015-08-07 | 2015-12-16 | 北京思特奇信息技术股份有限公司 | Relationship object recursion merging calculation method and system |
CN106569986A (en) * | 2015-10-12 | 2017-04-19 | 北京国双科技有限公司 | Character string replacement method and device |
Non-Patent Citations (1)
Title |
---|
许晞: ""通用查询程序的设计与实现"", 《现代计算机》 * |
Also Published As
Publication number | Publication date |
---|---|
CN108430045B (en) | 2020-11-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3869403A2 (en) | Image recognition method, apparatus, electronic device, storage medium and program product | |
CN103347009B (en) | A kind of information filtering method and device | |
CN107247722B (en) | File scanning method and device and intelligent terminal | |
CN110737604A (en) | method, device, electronic equipment and storage medium for automatically cleaning memory | |
CN110647562A (en) | Data query method and device, electronic equipment and storage medium | |
CN110516752A (en) | Cluster quality evaluation method, device and equipment and storage medium | |
CN111459376B (en) | Product guiding method, device and equipment | |
CN110471764A (en) | A kind of processing method and processing device of memory cleaning | |
CN110955375B (en) | Game-based target object operation processing method and device and touch terminal | |
CN108430045B (en) | Character string trimming method and device | |
CN104915458A (en) | Automatic association method and system during application search by user, and mobile terminal | |
JP2005284608A (en) | System and method for data search | |
CN107741980A (en) | Topic searching method, topic searching device and electronic terminal | |
CN111177147B (en) | Metadata batch warehousing method, readable storage medium and computing device | |
EP2990983A1 (en) | Method and apparatus for scanning files | |
CN110750973A (en) | Dynamic template configuration method and system | |
CN110049535A (en) | Network search method, device, equipment and storage medium | |
CN104410744A (en) | Intelligent minor-number-based dialing method and device | |
CN109828894B (en) | Device state data collection method, device, storage medium and electronic device | |
CN113157566A (en) | Screen control method, device, equipment and storage medium | |
CN113760237A (en) | Compiling address updating method and device, terminal equipment and readable storage medium | |
CN113589987A (en) | Folder display method and device and computer equipment | |
CN112527621A (en) | Test path construction method, device, equipment and storage medium | |
WO2019140959A1 (en) | Searching method and device and server | |
US20190347116A1 (en) | Assisting users to execute content copied from electronic document in user's computing environment |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |