CN110119495A - Conversion method, system, computer equipment and the medium of digit strings - Google Patents
Conversion method, system, computer equipment and the medium of digit strings Download PDFInfo
- Publication number
- CN110119495A CN110119495A CN201810109907.XA CN201810109907A CN110119495A CN 110119495 A CN110119495 A CN 110119495A CN 201810109907 A CN201810109907 A CN 201810109907A CN 110119495 A CN110119495 A CN 110119495A
- Authority
- CN
- China
- Prior art keywords
- character string
- unit
- chinese
- different levels
- digit strings
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/12—Use of codes for handling textual entities
- G06F40/151—Transformation
Abstract
The present invention provides a kind of conversion method of digit strings, system, computer equipment and media.Wherein, a kind of conversion method of digit strings, comprising: building Hash Map;Digit strings are received, determine the type of digit strings;Target type is obtained, judges whether type is consistent with target type;If inconsistent, according to Hash Map, the type of digit strings is converted into target type.According to the technical solution of the present invention, the mutual conversion between different types of digit strings is realized, manual modification is not necessarily to, to improve the efficiency that writing is examined and revised, reduces the fault artificially converted.
Description
Technical field
The present invention relates to field of computer technology, in particular to a kind of conversion method of digit strings, a kind of number
The converting system of word character string, a kind of computer equipment, a kind of computer readable storage medium.
Background technique
At present in digital publishing industry, especially during the writing of reference book, often due to editor is to international standard
Unit using insensitive, often will appear local unit, such as: jin, the units such as very little, system are often held very much by regular expression
It easily detects non-SI units and its quantifier, but is often difficult to provide reasonable conversion suggestion after detecting result,
Such as: two jin ought to be converted to one kilogram, then the calculating process bad processing of this suggestion, and if solving Chinese-character digital
Turn Arabic numerals, Arabic numerals, which turn Chinese character so two processes, this problem, to be readily solved, and can write to editor
Very big convenience is brought in the process, greatly improves editorial efficiency.Equally, during the books' copyright trade of finance and economic, also have such
As problem, be frequently encountered the problem that Arabic numerals are converted into financial number, be all laborious transferring or check and correction, this meeting at present
It is brought a lot of trouble to editorial staff, therefore, the mutual conversion of Chinese-character digital and Arabic numerals just becomes particularly important.
Currently, the writing of the books for reference book writing and finance and economic, is all often manual modification after editor verifies, it is past
Very long toward process is examined and revised, modification is troublesome, and after realizing the mutual conversion of Chinese-character digital and Arabic numerals, this is just
Become very simple, the efficiency that writing is examined and revised can not only be improved, moreover it is possible to reduce the fault artificially converted.
Summary of the invention
The present invention is directed to solve at least one of the technical problems existing in the prior art or related technologies.
For this purpose, it is an aspect of the invention to propose a kind of conversion method of digit strings.
Another aspect of the present invention is to propose a kind of converting system of digit strings.
Another aspect of the invention is to propose a kind of computer equipment.
Another aspect of the present invention is to propose a kind of computer readable storage medium.
In view of this, the invention proposes a kind of conversion methods of digit strings, comprising: building Hash Map;It connects
Digit strings are received, determine the type of digit strings;Target type is obtained, judges whether type is consistent with target type;If
It is inconsistent, according to Hash Map, the type of digit strings is converted into target type.
The conversion method of digit strings according to the present invention by receiving digit strings, and judges the character string
Affiliated type is compared by affiliated type with target type, when affiliated type and target type are inconsistent, to the character string
It is converted, obtains the character string of target type.According to the technical solution of the present invention, different types of digit strings are realized
Between mutual conversion, be not necessarily to manual modification, to improve the efficiency that writing is examined and revised, reduce the fault artificially converted.
In addition, the conversion method of above-mentioned digit strings according to the present invention, can also have following additional technology special
Sign:
In the above-mentioned technical solutions, it is preferable that digit strings include: Chinese character string, Arabic character string, financial word
Symbol string.
In the technical scheme, digit strings include such as Chinese character string, Arabic character string, financial character string,
Including the mutual conversion of Chinese character string and Arabic character string in the conversion process to digit strings.Wherein when receiving
Digit strings be that Arabic character string needs Arabic character string being converted to the Chinese when target type is financial character string
Language character string and then be converted to financial character string;Likewise, when the digit strings received are financial character string, target
When type is Arabic character string, need that financial digital full format is first turned to common Chinese figure.Skill through the invention
Art scheme solves current digital publishing industry, especially during book editor, can not be automatically performed Chinese-character digital and I
The problem of mutual conversion of uncle's number.
In any of the above-described technical solution, it is preferable that the step of constructing Hash Map, comprising: use the first mapping table
Store the key-value pair of Chinese numbers and Arabic numerals;The corresponding Chinese numbers of finance number are stored using the second mapping table;It adopts
The corresponding Arabic numerical value of unit quantifiers at different levels is stored with third mapping table.
In the technical scheme, in mutual conversion process, three static Hashing mapping table HashMap are constructed, respectively
For the first mapping table numMap, the second mapping table simpleNumToComplexMap, third mapping table unitMap, to solve
Single character traverses value.Wherein that numMap is stored is the key-value pair key-value of Chinese figure and Arabic numerals, wherein
Key is Chinese figure, and value is Arabic numerals, such as: " numMap.put (" zero ", 0);NumMap.put (" one ",
1);", successively storing zero to nine corresponding numbers is 0 to 9;SimpleNumToComplexMap storage is that financial number is corresponding
Common Chinese numbers, such as: " simpleNumToComplexMap.put (" one ", " one ");
SimpleNumToComplexMap.put (" two ", " two ");", what can successively be occurred in storage finance is all digital and its corresponding
Relationship;UnitMap storage is the corresponding number of units at different levels, such as: " unitMap.put (" hundred million ", 100000000L);
UnitMap.put (" million ", 1000000000000L);", wherein million representatives is trillion, maximum conversion is supported in the algorithm
Rank is trillion ranks.According to the technical solution of the present invention, it solves the problems, such as the verification of real process Plays unit, is tool
The standard verification of amount and unit during book writing provides reliable basis, equally, in the books in terms of writing finance, energy
It is enough to be converted mutually according to the number of offer, that is, it can solve Chinese numbers operation, Arabic numerals can also be supported to practise in finance
Normalized written on used, the writing of reference book purpose provides convenience thus.
In any of the above-described technical solution, it is preferable that the step of type of digit strings is converted to target type, packet
It includes and Chinese character string is converted into Arabic character string: Chinese character string is divided into integer-bit Z1 and decimal place Z2;According to each
Grade unit quantifier divides integer-bit Z1, obtains unit sections at different levels;The value of unit sections at different levels is calculated, then is added to obtain Z1 pairs of integer-bit
The Arabic character string z1 answered;Each character in decimal place Z2 is traversed, it is corresponding that each character is taken out from the first mapping table
Arabic numerals, and it is spliced into character string z2 in order;Arabic character string after then converting are as follows: z1.z2.
In the technical scheme, after being passed to Chinese figure, integer-bit character string Z1 and decimal place word are obtained with " point " cutting
Each character will be traversed in symbol string Z2, decimal place character string Z2, will successively be taken out corresponding to each character from the first mapping table
Arabic numerals are spliced into new character strings z2, i.e. fractional part in order;Using unit quantifiers at different levels by integer-bit character string Z1
Unit sections at different levels are divided into, unit quantifiers at different levels include such as ten thousand, hundred million, million, wherein million are trillion substitute, therefore are cutting
It needs to replace with million for trillion from integer-bit before cutting;Integer-bit character string Z1 then is cut with unit quantifiers at different levels, is obtained
The Chinese figure of each unit section calculates the value of each unit section, obtains integer-bit for the value of constituent parts section is added together
The corresponding Arabic numerals z1 of Z1, then the arabic numeric characters string finally switched to is (z1+ " "+z2), the character string is strong
Switch to number, as " z1.z2 ".
In any of the above-described technical solution, it is preferable that the step of calculating the value of unit sections at different levels, comprising: successively from different levels
The Chinese numbers before unit quantifier are taken out in unit section, and the corresponding Arabic numerals of Chinese numbers are taken out from the first mapping table,
The corresponding Arabic numerical value of unit quantifier is taken out from third mapping table again, is multiplied obtains the numerical value of unit sections at different levels respectively.
In the technical scheme, it is illustrated with specific embodiment, obtains Chinese after replacing with " million " for trillion in Z1
Hundred million Y3 of digital million Y2 of Y1, ten thousand Y4 is then respectively cut million Y2 of Y1, hundred million Y3, ten thousand Y4 with " million ", " hundred million ", " ten thousand ", obtains each unit section
Chinese figure Y1, Y2, Y3, Y4, successively to Y1, Y2, Y3, Y4 takes out the number before quantifier " ten ", " hundred ", " thousand ", utilizes the
One mapping table takes out corresponding Arabic numerals, then using third mapping table take out " ten ", " hundred ", " thousand " it is corresponding it is at different levels I
Uncle number, respectively be multiplied obtain the corresponding numerical value M1M2M3M4 of each quantifier rank of Y1Y2Y3Y4, then Z1 conversion after I
The corresponding hundred million corresponding numerical value+M4 of corresponding numerical value+M3* ten thousand of numerical value+M2* of uncle's number z1=M1* million, then the Ah finally switched to
Arabic numbers character string is (z1+ " "+z2), which is switched to by force number, as " z1.z2 ".
In any of the above-described technical solution, it is preferable that the step of type of digit strings is converted into target type, also
Including Arabic character string is converted to Chinese character string: Arabic character string is divided into integer-bit and decimal place;To integer
Position is cut from left to right according to every 4-digit number, obtains the value of units at different levels;The digit order number in the value of units at different levels is traversed,
It takes out the corresponding Chinese numbers of each digit order number respectively from the first mapping table, then successively adds unit quantifier since ten;
Character string after additional unit quantifier is spelled into the corresponding Chinese character of upper unit at different levels, obtains the corresponding Chinese character of value of units at different levels
String;The corresponding Chinese character string of the value of units at different levels is stitched together to get the Chinese character string to after converting.
In the technical scheme, it is passed to Arabic numerals (such as b1b2b3X.a1a2a3X, wherein X represents digit and is not fixed)
Afterwards, it is first cut with " ", obtains integer-bit and decimal place, decimal place successively obtains its correspondence by value from the first mapping table
Key, being spliced into character string is exactly decimal bit position A1A2A3X;Integer part is cut from left to right according to every 4-digit number
Cut, specifically, integer part b1b2b3X is first obtained y1 (trillion numbers) with trillion complementations, b1b2b3X to trillion modulus again
Hundred million complementations are obtained y2 (hundred million numbers), b1b2b3X obtains y3 (number of myriabit) hundred million modulus to ten thousand complementations again, and b1b2b3X pairs
Ten thousand modulus obtain y4 (myriabit number below), wherein it will be evident that the digit of y1y2y3y4 is less than certainly equal to 4, obtain at different levels
The value of unit;By the digit order number in the value of units at different levels successively from a, ten, hundred, kilobit traversal, taken respectively from the first mapping table
The corresponding Chinese-character digital of each digit order number out, then unit quantifier (ten, hundred, thousand) are added since ten, units pair at different levels in spelling
The corresponding Chinese character of value of units at different levels can be obtained in the Chinese character answered;Wherein, when being converted to every grade of unit, if y1!=
0&&y2==0&&y4!=0 explanation trillion has hundred million grades of value not have value after value and hundred million, then hundred million whole zero paddings, if y2!=0, when
When y2 length is less than four, " 0 " polishing four is mended from left to right, and y1 conversion method is called to obtain the Chinese figure Y2 after y2 conversion,
Similarly the processing of y3 obtains Y3 as y2, the processing for y4, if y4!=0&& (y1!=0 | | y2!=0 | | y3!=0)
Y4 is handled by y2, y3 mode, if y4!=0&& (y1==0 | | y2==0 | | y3==0) be directly converted to Contemporary Digital
Chinese figure, subsequent not need to mend unit, if y4==0, direct zero padding, centralized system processing y4 obtains Y4, finally turns
The character string of change is Y1Y2Y3Y4.
In any of the above-described technical solution, it is preferable that conversion method further include: whether the Chinese character string after judging conversion
With 10 beginnings, if so, replacing with ten for 10;Whether the Chinese character string after judging conversion is with zero ending, if so, will
Zero replaces with null character;Whether comprising continuous multiple zero in Chinese character string after judging conversion, if so, will be continuous multiple
Zero replaces with one zero.
In the technical scheme, if " 10 " of beginning are replaced with " ten " with " 10 " beginning by Y1Y2Y3Y4, if
" zero " of ending is replaced with null character with " zero " ending by Y1Y2Y3Y4, finally will be continuous in Y1Y2Y3Y4 using canonical
Multiple " zero " replace with one " zero ", and the Chinese figure that Arabic numerals are converted to can be obtained.
In any of the above-described technical solution, it is preferable that conversion method further include: according to the second mapping table by financial character string
It is mutually converted with Chinese character string.
In the technical scheme, if to obtain financial number, successively each character in Chinese figure is reflected from second
Corresponding finance number replacement is taken out in firing table.
The invention also provides a kind of converting systems of digit strings, comprising: construction unit, for constructing Hash mapping
Table;Receiving unit determines the type of digit strings for receiving digit strings;Judging unit, for obtaining target class
Type judges whether type is consistent with target type;If inconsistent, converting unit is used for according to Hash Map, by numerical character
The type of string is converted to target type.
The converting system of digit strings according to the present invention by receiving digit strings, and judges the character string
Affiliated type is compared by affiliated type with target type, when affiliated type and target type are inconsistent, to the character string
It is converted, obtains the character string of target type.According to the technical solution of the present invention, different types of digit strings are realized
Between mutual conversion, be not necessarily to manual modification, to improve the efficiency that writing is examined and revised, reduce the fault artificially converted.
In the above-mentioned technical solutions, it is preferable that digit strings include: Chinese character string, Arabic character string, financial word
Symbol string.
In the technical scheme, digit strings include such as Chinese character string, Arabic character string, financial character string,
Including the mutual conversion of Chinese character string and Arabic character string in the conversion process to digit strings.Wherein when receiving
Digit strings be that Arabic character string needs Arabic character string being converted to the Chinese when target type is financial character string
Language character string and then be converted to financial character string;Likewise, when the digit strings received are financial character string, target
When type is Arabic character string, need that financial digital full format is first turned to common Chinese figure.Skill through the invention
Art scheme solves current digital publishing industry, especially during book editor, can not be automatically performed Chinese-character digital and I
The problem of mutual conversion of uncle's number.
In any of the above-described technical solution, it is preferable that construction unit is specifically used for: storing Chinese using the first mapping table
The key-value pair of number and Arabic numerals;The corresponding Chinese numbers of finance number are stored using the second mapping table;It is reflected using third
Firing table stores the corresponding Arabic numerical value of unit quantifiers at different levels.
In the technical scheme, in mutual conversion process, three static Hashing mapping table HashMap are constructed, respectively
For the first mapping table numMap, the second mapping table simpleNumToComplexMap, third mapping table unitMap, to solve
Single character traverses value.Wherein that numMap is stored is the key-value pair key-value of Chinese figure and Arabic numerals, wherein
Key is Chinese figure, and value is Arabic numerals, such as: " numMap.put (" zero ", 0);NumMap.put (" one ",
1);", successively storing zero to nine corresponding numbers is 0 to 9;SimpleNumToComplexMap storage is that financial number is corresponding
Common Chinese numbers, such as: " simpleNumToComplexMap.put (" one ", " one ");
SimpleNumToComplexMap.put (" two ", " two ");", what can successively be occurred in storage finance is all digital and its corresponding
Relationship;UnitMap storage is the corresponding number of units at different levels, such as: " unitMap.put (" hundred million ", 100000000L);
UnitMap.put (" million ", 1000000000000L);", wherein million representatives is trillion, maximum conversion is supported in the algorithm
Rank is trillion ranks.According to the technical solution of the present invention, it solves the problems, such as the verification of real process Plays unit, is tool
The standard verification of amount and unit during book writing provides reliable basis, equally, in the books in terms of writing finance, energy
It is enough to be converted mutually according to the number of offer, that is, it can solve Chinese numbers operation, Arabic numerals can also be supported to practise in finance
Normalized written on used, the writing of reference book purpose provides convenience thus.
In any of the above-described technical solution, it is preferable that converting unit, for Chinese character string to be converted to Arabic character
String: Chinese character string is divided into integer-bit Z1 and decimal place Z2;Divide integer-bit Z1 according to unit quantifiers at different levels, obtains at different levels
Unit section;The value of unit sections at different levels is calculated, then is added to obtain the corresponding Arabic character string z1 of integer-bit Z1;Traverse decimal place Z2
In each character, the corresponding Arabic numerals of each character are taken out from the first mapping table, and be spliced into character string in order
z2;Arabic character string after then converting are as follows: z1.z2.
In the technical scheme, after being passed to Chinese figure, integer-bit character string Z1 and decimal place word are obtained with " point " cutting
Each character will be traversed in symbol string Z2, decimal place character string Z2, will successively be taken out corresponding to each character from the first mapping table
Arabic numerals are spliced into new character strings z2, i.e. fractional part in order;Using unit quantifiers at different levels by integer-bit character string Z1
Unit sections at different levels are divided into, unit quantifiers at different levels include such as ten thousand, hundred million, million, wherein million are trillion substitute, therefore are cutting
It needs to replace with million for trillion from integer-bit before cutting;Integer-bit character string Z1 then is cut with unit quantifiers at different levels, is obtained
The Chinese figure of each unit section calculates the value of each unit section, obtains integer-bit for the value of constituent parts section is added together
The corresponding Arabic numerals z1 of Z1, then the arabic numeric characters string finally switched to is (z1+ " "+z2), the character string is strong
Switch to number, as " z1.z2 ".
In any of the above-described technical solution, it is preferable that the step of calculating the value of unit sections at different levels, comprising: successively from different levels
The Chinese numbers before unit quantifier are taken out in unit section, and the corresponding Arabic numerals of Chinese numbers are taken out from the first mapping table,
The corresponding Arabic numerical value of unit quantifier is taken out from third mapping table again, is multiplied obtains the numerical value of unit sections at different levels respectively
“×”。
In the technical scheme, it is illustrated with specific embodiment, obtains Chinese after replacing with " million " for trillion in Z1
Hundred million Y3 of digital million Y2 of Y1, ten thousand Y4 is then respectively cut million Y2 of Y1, hundred million Y3, ten thousand Y4 with " million ", " hundred million ", " ten thousand ", obtains each unit section
Chinese figure Y1, Y2, Y3, Y4, successively to Y1, Y2, Y3, Y4 takes out the number before quantifier " ten ", " hundred ", " thousand ", utilizes the
One mapping table takes out corresponding Arabic numerals, then using third mapping table take out " ten ", " hundred ", " thousand " it is corresponding it is at different levels I
Uncle number, respectively be multiplied obtain the corresponding numerical value M1M2M3M4 of each quantifier rank of Y1Y2Y3Y4, then Z1 conversion after I
The corresponding hundred million corresponding numerical value+M4 of corresponding numerical value+M3* ten thousand of numerical value+M2* of uncle's number z1=M1* million, then the Ah finally switched to
Arabic numbers character string is (z1+ " "+z2), which is switched to by force number, as " z1.z2 ".
In any of the above-described technical solution, it is preferable that converting unit is also used to Arabic character string being converted to Chinese word
Symbol string: Arabic character string is divided into integer-bit and decimal place;Integer-bit is cut from left to right according to every 4-digit number
It cuts, obtains the value of units at different levels;The digit order number in the value of units at different levels is traversed, takes out each number respectively from the first mapping table
The corresponding Chinese numbers in position, then unit quantifier is successively added since ten;Character string after additional unit quantifier is spelled upper each
The corresponding Chinese character of grade unit, obtains the corresponding Chinese character string of value of units at different levels;By the corresponding Chinese word of the value of units at different levels
Symbol string is stitched together to get the Chinese character string to after converting.
In the technical scheme, it is passed to Arabic numerals (such as b1b2b3X.a1a2a3X, wherein X represents digit and is not fixed)
Afterwards, it is first cut with " ", obtains integer-bit and decimal place, decimal place successively obtains its correspondence by value from the first mapping table
Key, being spliced into character string is exactly decimal bit position A1A2A3X;Integer part is cut from left to right according to every 4-digit number
Cut, specifically, integer part b1b2b3X is first obtained y1 (trillion numbers) with trillion complementations, b1b2b3X to trillion modulus again
Hundred million complementations are obtained y2 (hundred million numbers), b1b2b3X obtains y3 (number of myriabit) hundred million modulus to ten thousand complementations again, and b1b2b3X pairs
Ten thousand modulus obtain y4 (myriabit number below), wherein it will be evident that the digit of y1y2y3y4 is less than certainly equal to 4, obtain at different levels
The value of unit;By the digit order number in the value of units at different levels successively from a, ten, hundred, kilobit traversal, taken respectively from the first mapping table
The corresponding Chinese-character digital of each digit order number out, then unit quantifier (ten, hundred, thousand) are added since ten, units pair at different levels in spelling
The corresponding Chinese character of value of units at different levels can be obtained in the Chinese character answered;Wherein, when being converted to every grade of unit, if y1!=
0&&y2==0&&y4!=0 explanation trillion has hundred million grades of value not have value after value and hundred million, then hundred million whole zero paddings, if y2!=0, when
When y2 length is less than four, " 0 " polishing four is mended from left to right, and y1 conversion method is called to obtain the Chinese figure Y2 after y2 conversion,
Similarly the processing of y3 obtains Y3 as y2, the processing for y4, if y4!=0&& (y1!=0 | | y2!=0 | | y3!=0)
Y4 is handled by y2, y3 mode, if y4!=0&& (y1==0 | | y2==0 | | y3==0) be directly converted to Contemporary Digital
Chinese figure, subsequent not need to mend unit, if y4==0, direct zero padding, centralized system processing y4 obtains Y4, finally turns
The character string of change is Y1Y2Y3Y4.
In any of the above-described technical solution, it is preferable that converting unit is also used to: judgement conversion after Chinese character string with
10 beginnings, if so, replacing with ten for 10;Whether the Chinese character string after judging conversion is with zero ending, if so, by zero
Replace with null character;Whether comprising continuous multiple zero in Chinese character string after judging conversion, if so, by continuous multiple zero
Replace with one zero.
In the technical scheme, if " 10 " of beginning are replaced with " ten " with " 10 " beginning by Y1Y2Y3Y4, if
" zero " of ending is replaced with null character with " zero " ending by Y1Y2Y3Y4, finally will be continuous in Y1Y2Y3Y4 using canonical
Multiple " zero " replace with one " zero ", and the Chinese figure that Arabic numerals are converted to can be obtained.
In any of the above-described technical solution, it is preferable that converting unit is also used to: according to the second mapping table by financial character
String is mutually converted with Chinese character string.
In the technical scheme, if to obtain financial number, successively each character in Chinese figure is reflected from second
Corresponding finance number replacement is taken out in firing table.
The invention also provides a kind of computer equipment, including memory, processor and storage are on a memory and can be
The computer program run on processor, processor are used to execute the conversion such as the digit strings in any of the above-described technical solution
The step of.
Computer equipment according to the present invention, the processor for being included is for executing as in any of the above-described technical solution
The step of conversion of digit strings, thus the computer equipment can be realized the beneficial effect of the conversion whole of the digit strings
Fruit repeats no more.
The invention also provides a kind of computer readable storage mediums, are stored thereon with computer program, computer program
The step of conversion such as the digit strings in any of the above-described technical solution is realized when being executed by processor.
Computer readable storage medium according to the present invention, the realization when computer program stored thereon is executed by processor
As digit strings in any of the above-described technical solution conversion the step of, thus the computer readable storage medium can be real
The now whole beneficial effect of the conversion of the digit strings, repeats no more.
Additional aspect and advantage of the invention will become obviously in following description section, or practice through the invention
Recognize.
Detailed description of the invention
Above-mentioned and/or additional aspect of the invention and advantage will become from the description of the embodiment in conjunction with the following figures
Obviously and it is readily appreciated that, in which:
Fig. 1 shows the flow diagram of the conversion method of digit strings according to an embodiment of the invention;
Fig. 2 shows the flow diagrams of the conversion method of digit strings according to another embodiment of the invention;
Fig. 3 shows the flow diagram of the conversion method of the digit strings of still another embodiment in accordance with the present invention;
Fig. 4 shows the flow diagram of the conversion method of digit strings according to still another embodiment of the invention;
Fig. 5 shows the schematic block diagram of the converting system of digit strings according to an embodiment of the invention;
Fig. 6 shows the schematic block diagram of computer equipment according to an embodiment of the invention.
Specific embodiment
To better understand the objects, features and advantages of the present invention, with reference to the accompanying drawing and specific real
Applying mode, the present invention is further described in detail.It should be noted that in the absence of conflict, the implementation of the application
Feature in example and embodiment can be combined with each other.
In the following description, numerous specific details are set forth in order to facilitate a full understanding of the present invention, still, the present invention may be used also
To be implemented using other than the one described here other modes, therefore, protection scope of the present invention is not by described below
Specific embodiment limitation.
As shown in Figure 1, the flow diagram of the conversion method of digit strings according to an embodiment of the invention.Its
In, the conversion method of the digit strings, comprising:
Step 102, Hash Map is constructed;
Step 104, digit strings are received, determine the type of digit strings;
Step 106, target type is obtained, judges whether type is consistent with target type;
Step 108, if it is inconsistent, according to Hash Map, the type of digit strings is converted into target type.
The conversion method of digit strings provided by the invention by receiving digit strings, and judges the character string
Affiliated type is compared by affiliated type with target type, when affiliated type and target type are inconsistent, to the character string
It is converted, obtains the character string of target type.Embodiment through the invention, realize different types of digit strings it
Between mutual conversion, be not necessarily to manual modification, to improve the efficiency that writing is examined and revised, reduce the fault artificially converted.
In the above embodiment, it is preferable that digit strings include: Chinese character string, Arabic character string, financial character
String.
In this embodiment, digit strings include such as Chinese character string, Arabic character string, financial character string,
Mutual conversion in the conversion process of digit strings including Chinese character string and Arabic character string.Wherein when receiving
Digit strings are that Arabic character string needs Arabic character string being converted to Chinese when target type is financial character string
Character string and then be converted to financial character string;Likewise, when the digit strings received are financial character string, target class
When type is Arabic character string, need that financial digital full format is first turned to common Chinese figure.Implementation through the invention
Example, solves current digital publishing industry, especially during book editor, can not be automatically performed Chinese-character digital and Arabic number
The problem of mutual conversion of word.
As shown in Fig. 2, the flow diagram of the conversion method of digit strings according to another embodiment of the invention.
Wherein, the conversion method of the digit strings, comprising:
Step 202, Hash Map is constructed: using the key assignments of the first mapping table storage Chinese numbers and Arabic numerals
It is right;The corresponding Chinese numbers of finance number are stored using the second mapping table;Unit quantifiers pair at different levels are stored using third mapping table
The Arabic numerical value answered;
Step 204, digit strings are received, determine the type of digit strings;
Step 206, target type is obtained, judges whether type is consistent with target type;
Step 208, if it is inconsistent, according to Hash Map, the type of digit strings is converted into target type.
In this embodiment, in mutual conversion process, three static Hashing mapping table HashMap are constructed, respectively
First mapping table numMap, the second mapping table simpleNumToComplexMap, third mapping table unitMap, to solve list
A character traverses value.Wherein that numMap is stored is the key-value pair key-value of Chinese figure and Arabic numerals, wherein
Key is Chinese figure, and value is Arabic numerals, such as: " numMap.put (" zero ", 0);NumMap.put (" one ",
1);", successively storing zero to nine corresponding numbers is 0 to 9;SimpleNumToComplexMap storage is that financial number is corresponding
Common Chinese numbers, such as: " simpleNumToComplexMap.put (" one ", " one ");
SimpleNumToComplexMap.put (" two ", " two ");", what can successively be occurred in storage finance is all digital and its corresponding
Relationship;UnitMap storage is the corresponding number of units at different levels, such as: " unitMap.put (" hundred million ", 100000000L);
UnitMap.put (" million ", 1000000000000L);", wherein million representatives is trillion, maximum conversion is supported in the algorithm
Rank is trillion ranks.Embodiment through the invention solves the problems, such as the verification of real process Plays unit, is reference book
The standard verification of amount and unit during writing provides reliable basis equally, can in the books in terms of writing finance
It is converted mutually according to the number of offer, that is, can solve Chinese numbers operation, Arabic numerals can also be supported to be accustomed in finance
On normalized written, thus the writing of reference book purpose provide convenience.
As shown in figure 3, the flow diagram of the conversion method of the digit strings of still another embodiment in accordance with the present invention.
Wherein, the conversion method of the digit strings, comprising:
Step 302, Hash Map is constructed: using the key assignments of the first mapping table storage Chinese numbers and Arabic numerals
It is right;The corresponding Chinese numbers of finance number are stored using the second mapping table;Unit quantifiers pair at different levels are stored using third mapping table
The Arabic numerical value answered;
Step 304, digit strings are received, determine the type of digit strings;
Step 306, target type is obtained, judges whether type is consistent with target type;
Step 308, if it is inconsistent, according to Hash Map, the type of digit strings is converted into target type;Its
In, the step of type of digit strings is converted into target type, comprising:
Chinese character string is converted into Arabic character string:
Chinese character string is divided into integer-bit Z1 and decimal place Z2;Divide integer-bit Z1 according to unit quantifiers at different levels, obtains
To unit sections at different levels;The value of unit sections at different levels is calculated, then is added to obtain the corresponding Arabic character string z1 of integer-bit Z1;It traverses small
Each character in numerical digit Z2 takes out the corresponding Arabic numerals of each character from the first mapping table, and is spliced into order
Character string z2;Arabic character string after then converting are as follows: z1.z2.
In this embodiment, after being passed to Chinese figure, integer-bit character string Z1 and decimal place character are obtained with " point " cutting
Go here and there Z2, each character will be traversed in decimal place character string Z2, successively taken out from the first mapping table corresponding to each character Ah
Arabic numbers is spliced into new character strings z2, i.e. fractional part in order;Using unit quantifiers at different levels by integer-bit character string Z1 points
Unit sections at different levels are segmented into, unit quantifiers at different levels include such as ten thousand, hundred million, million, wherein million are trillion substitute, therefore are cutting
It needs to replace with million for trillion from integer-bit before;Integer-bit character string Z1 then is cut with unit quantifiers at different levels, is obtained each
The Chinese figure of a unit section calculates the value of each unit section, obtains integer-bit Z1 for the value of constituent parts section is added together
Corresponding Arabic numerals z1 turns by force the character string then the arabic numeric characters string finally switched to is (z1+ " "+z2)
For number, as " z1.z2 ".
In any of the above-described embodiment, it is preferable that the step of calculating the value of unit sections at different levels, comprising: successively from lists at different levels
The Chinese numbers before unit quantifier are taken out in the section of position, and the corresponding Arabic numerals of Chinese numbers are taken out from the first mapping table, then
The corresponding Arabic numerical value of unit quantifier is taken out from third mapping table, is multiplied obtains the numerical value of unit sections at different levels respectively.
In this embodiment, it is illustrated with specific embodiment, obtains Chinese number after replacing with " million " for trillion in Z1
Million Y2 of word Y1, hundred million Y3, ten thousand Y4 is then respectively cut million Y2 of Y1, hundred million Y3, ten thousand Y4 with " million ", " hundred million ", " ten thousand ", obtains each unit section
Chinese figure Y1, Y2, Y3, Y4 successively take out the number before quantifier " ten ", " hundred ", " thousand ", utilize first to Y1, Y2, Y3, Y4
Mapping table takes out corresponding Arabic numerals, then takes out " ten ", " hundred ", " thousand " corresponding Arab at different levels using third mapping table
Number is multiplied obtains the corresponding numerical value M1M2M3M4 of each quantifier rank of Y1Y2Y3Y4 respectively, then the Arab after Z1 conversion
The corresponding hundred million corresponding numerical value+M4 of corresponding numerical value+M3* ten thousand of numerical value+M2* of digital z1=M1* million, then finally switch to I
Primary digit strings are (z1+ " "+z2), which are switched to by force number, as " z1.z2 ".
As shown in figure 4, the flow diagram of the conversion method of digit strings according to still another embodiment of the invention.
Wherein, the conversion method of the digit strings, comprising:
Step 402, Hash Map is constructed: using the key assignments of the first mapping table storage Chinese numbers and Arabic numerals
It is right;The corresponding Chinese numbers of finance number are stored using the second mapping table;Unit quantifiers pair at different levels are stored using third mapping table
The Arabic numerical value answered;
Step 404, digit strings are received, determine the type of digit strings;
Step 406, target type is obtained, judges whether type is consistent with target type;
Step 408, if it is inconsistent, according to Hash Map, the type of digit strings is converted into target type;Its
In, the step of type of digit strings is converted into target type, comprising:
Chinese character string is converted into Arabic character string:
Chinese character string is divided into integer-bit Z1 and decimal place Z2;Divide integer-bit Z1 according to unit quantifiers at different levels, obtains
To unit sections at different levels;The value of unit sections at different levels is calculated, then is added to obtain the corresponding Arabic character string z1 of integer-bit Z1;It traverses small
Each character in numerical digit Z2 takes out the corresponding Arabic numerals of each character from the first mapping table, and is spliced into order
Character string z2;Arabic character string after then converting are as follows: z1.z2;
The step of type of digit strings is converted into target type, further includes:
Arabic character string is converted into Chinese character string:
Arabic character string is divided into integer-bit and decimal place;Integer-bit is carried out from left to right according to every 4-digit number
Cutting, obtains the value of units at different levels;The digit order number in the value of units at different levels is traversed, takes out every number respectively from the first mapping table
The corresponding Chinese numbers of word bit, then unit quantifier is successively added since ten;Character string after additional unit quantifier is spelled
The corresponding Chinese character of unit at different levels, obtains the corresponding Chinese character string of value of units at different levels;By the corresponding Chinese of the value of units at different levels
String-concatenation is together to get the Chinese character string to after converting.
In this embodiment, after being passed to Arabic numerals (such as b1b2b3X.a1a2a3X, wherein X represents digit and is not fixed),
It is first cut with " ", obtains integer-bit and decimal place, it is corresponding that decimal place successively obtains its by value from the first mapping table
Key, being spliced into character string is exactly decimal bit position A1A2A3X;Integer part is cut from left to right according to every 4-digit number,
Specifically, integer part b1b2b3X first obtains y1 (trillion numbers) with trillion complementations, b1b2b3X is right again to trillion modulus
Hundred million complementations obtain y2 (hundred million numbers), and b1b2b3X obtains y3 (number of myriabit) to ten thousand complementations again to hundred million modulus, and b1b2b3X is to ten thousand
Modulus obtains y4 (myriabit number below), wherein it will be evident that the digit of y1y2y3y4 is less than certainly equal to 4, obtains lists at different levels
The value of position;By the digit order number in the value of units at different levels successively from a, ten, hundred, kilobit traversal, taken out respectively from the first mapping table
The corresponding Chinese-character digital of each digit order number, then unit quantifier (ten, hundred, thousand) are added since ten, units correspondences at different levels in spellings
Chinese character, the corresponding Chinese character of value of units at different levels can be obtained;Wherein, when being converted to every grade of unit, if y1!=
0&&y2==0&&y4!=0 explanation trillion has hundred million grades of value not have value after value and hundred million, then hundred million whole zero paddings, if y2!=0, when
When y2 length is less than four, " 0 " polishing four is mended from left to right, and y1 conversion method is called to obtain the Chinese figure Y2 after y2 conversion,
Similarly the processing of y3 obtains Y3 as y2, the processing for y4, if y4!=0&& (y1!=0 | | y2!=0 | | y3!=0)
Y4 is handled by y2, y3 mode, if y4!=0&& (y1==0 | | y2==0 | | y3==0) be directly converted to Contemporary Digital
Chinese figure, subsequent not need to mend unit, if y4==0, direct zero padding, centralized system processing y4 obtains Y4, finally turns
The character string of change is Y1Y2Y3Y4.
In any of the above-described embodiment, it is preferable that conversion method further include: judge conversion after Chinese character string whether with
10 beginnings, if so, replacing with ten for 10;Whether the Chinese character string after judging conversion is with zero ending, if so, by zero
Replace with null character;Whether comprising continuous multiple zero in Chinese character string after judging conversion, if so, by continuous multiple zero
Replace with one zero.
In this embodiment, if " 10 " of beginning are replaced with " ten " with " 10 " beginning by Y1Y2Y3Y4, if
" zero " of ending is replaced with null character with " zero " ending by Y1Y2Y3Y4, finally will be continuous in Y1Y2Y3Y4 using canonical
Multiple " zero " replace with one " zero ", and the Chinese figure that Arabic numerals are converted to can be obtained.
In any of the above-described embodiment, it is preferable that conversion method further include: according to the second mapping table by financial character string with
Chinese character string is mutually converted.
In this embodiment, if to obtain financial number, successively each character in Chinese figure is mapped from second
Corresponding finance number replacement is taken out in table.
As shown in figure 5, the schematic block diagram of the converting system of digit strings according to an embodiment of the invention.Its
In, the converting system 500 of the digit strings, comprising:
Construction unit 502, for constructing Hash Map;
Receiving unit 504 determines the type of digit strings for receiving digit strings;
Judging unit 506 judges whether type is consistent with target type for obtaining target type;
If inconsistent, converting unit 508, for according to Hash Map, the type of digit strings to be converted to target
Type.
The converting system 500 of digit strings provided by the invention by receiving digit strings, and judges the character string
Affiliated type, affiliated type is compared with target type, when affiliated type and target type it is inconsistent when, to the character
String is converted, and the character string of target type is obtained.Embodiment through the invention realizes different types of digit strings
Between mutual conversion, be not necessarily to manual modification, to improve the efficiency that writing is examined and revised, reduce the fault artificially converted.
In the above embodiment, it is preferable that digit strings include: Chinese character string, Arabic character string, financial character
String.
In this embodiment, digit strings include such as Chinese character string, Arabic character string, financial character string,
Mutual conversion in the conversion process of digit strings including Chinese character string and Arabic character string.Wherein when receiving
Digit strings are that Arabic character string needs Arabic character string being converted to Chinese when target type is financial character string
Character string and then be converted to financial character string;Likewise, when the digit strings received are financial character string, target class
When type is Arabic character string, need that financial digital full format is first turned to common Chinese figure.Implementation through the invention
Example, solves current digital publishing industry, especially during book editor, can not be automatically performed Chinese-character digital and Arabic number
The problem of mutual conversion of word.
In any of the above-described embodiment, it is preferable that construction unit 502 is specifically used for: storing Chinese using the first mapping table
The key-value pair of number and Arabic numerals;The corresponding Chinese numbers of finance number are stored using the second mapping table;It is reflected using third
Firing table stores the corresponding Arabic numerical value of unit quantifiers at different levels.
In this embodiment, in mutual conversion process, three static Hashing mapping table HashMap are constructed, respectively
First mapping table numMap, the second mapping table simpleNumToComplexMap, third mapping table unitMap, to solve list
A character traverses value.Wherein that numMap is stored is the key-value pair key-value of Chinese figure and Arabic numerals, wherein
Key is Chinese figure, and value is Arabic numerals, such as: " numMap.put (" zero ", 0);NumMap.put (" one ",
1);", successively storing zero to nine corresponding numbers is 0 to 9;SimpleNumToComplexMap storage is that financial number is corresponding
Common Chinese numbers, such as: " simpleNumToComplexMap.put (" one ", " one ");
SimpleNumToComplexMap.put (" two ", " two ");", what can successively be occurred in storage finance is all digital and its corresponding
Relationship;UnitMap storage is the corresponding number of units at different levels, such as: " unitMap.put (" hundred million ", 100000000L);
UnitMap.put (" million ", 1000000000000L);", wherein million representatives is trillion, maximum conversion is supported in the algorithm
Rank is trillion ranks.Embodiment through the invention solves the problems, such as the verification of real process Plays unit, is reference book
The standard verification of amount and unit during writing provides reliable basis equally, can in the books in terms of writing finance
It is converted mutually according to the number of offer, that is, can solve Chinese numbers operation, Arabic numerals can also be supported to be accustomed in finance
On normalized written, thus the writing of reference book purpose provide convenience.
In any of the above-described embodiment, it is preferable that converting unit 508 is used for: Chinese character string is converted to Arabic word
Symbol string: Chinese character string is divided into integer-bit Z1 and decimal place Z2;Divide integer-bit Z1 according to unit quantifiers at different levels, obtains each
Grade unit section;The value of unit sections at different levels is calculated, then is added to obtain the corresponding Arabic character string z1 of integer-bit Z1;Traverse decimal place
Each character in Z2 takes out the corresponding Arabic numerals of each character from the first mapping table, and is spliced into character in order
String z2;Arabic character string after then converting are as follows: z1.z2.
In this embodiment, after being passed to Chinese figure, integer-bit character string Z1 and decimal place character are obtained with " point " cutting
Go here and there Z2, each character will be traversed in decimal place character string Z2, successively taken out from the first mapping table corresponding to each character Ah
Arabic numbers is spliced into new character strings z2, i.e. fractional part in order;Using unit quantifiers at different levels by integer-bit character string Z1 points
Unit sections at different levels are segmented into, unit quantifiers at different levels include such as ten thousand, hundred million, million, wherein million are trillion substitute, therefore are cutting
It needs to replace with million for trillion from integer-bit before;Integer-bit character string Z1 then is cut with unit quantifiers at different levels, is obtained each
The Chinese figure of a unit section calculates the value of each unit section, obtains integer-bit Z1 for the value of constituent parts section is added together
Corresponding Arabic numerals z1 turns by force the character string then the arabic numeric characters string finally switched to is (z1+ " "+z2)
For number, as " z1.z2 ".
In any of the above-described embodiment, it is preferable that the step of calculating the value of unit sections at different levels, comprising: successively from lists at different levels
The Chinese numbers before unit quantifier are taken out in the section of position, and the corresponding Arabic numerals of Chinese numbers are taken out from the first mapping table, then
The corresponding Arabic numerical value of unit quantifier is taken out from third mapping table, is multiplied obtains the numerical value "×" of unit sections at different levels respectively.
In this embodiment, it is illustrated with specific embodiment, obtains Chinese number after replacing with " million " for trillion in Z1
Million Y2 of word Y1, hundred million Y3, ten thousand Y4 is then respectively cut million Y2 of Y1, hundred million Y3, ten thousand Y4 with " million ", " hundred million ", " ten thousand ", obtains each unit section
Chinese figure Y1, Y2, Y3, Y4 successively take out the number before quantifier " ten ", " hundred ", " thousand ", utilize first to Y1, Y2, Y3, Y4
Mapping table takes out corresponding Arabic numerals, then takes out " ten ", " hundred ", " thousand " corresponding Arab at different levels using third mapping table
Number is multiplied obtains the corresponding numerical value M1M2M3M4 of each quantifier rank of Y1Y2Y3Y4 respectively, then the Arab after Z1 conversion
The corresponding hundred million corresponding numerical value+M4 of corresponding numerical value+M3* ten thousand of numerical value+M2* of digital z1=M1* million, then finally switch to I
Primary digit strings are (z1+ " "+z2), which are switched to by force number, as " z1.z2 ".
In any of the above-described embodiment, it is preferable that converting unit 508 is also used to: Arabic character string is converted to Chinese
Character string: Arabic character string is divided into integer-bit and decimal place;Integer-bit is carried out from left to right according to every 4-digit number
Cutting, obtains the value of units at different levels;The digit order number in the value of units at different levels is traversed, takes out every number respectively from the first mapping table
The corresponding Chinese numbers of word bit, then unit quantifier is successively added since ten;Character string after additional unit quantifier is spelled
The corresponding Chinese character of unit at different levels, obtains the corresponding Chinese character string of value of units at different levels;By the corresponding Chinese of the value of units at different levels
String-concatenation is together to get the Chinese character string to after converting.
In this embodiment, after being passed to Arabic numerals (such as b1b2b3X.a1a2a3X, wherein X represents digit and is not fixed),
It is first cut with " ", obtains integer-bit and decimal place, it is corresponding that decimal place successively obtains its by value from the first mapping table
Key, being spliced into character string is exactly decimal bit position A1A2A3X;Integer part is cut from left to right according to every 4-digit number,
Specifically, integer part b1b2b3X first obtains y1 (trillion numbers) with trillion complementations, b1b2b3X is right again to trillion modulus
Hundred million complementations obtain y2 (hundred million numbers), and b1b2b3X obtains y3 (number of myriabit) to ten thousand complementations again to hundred million modulus, and b1b2b3X is to ten thousand
Modulus obtains y4 (myriabit number below), wherein it will be evident that the digit of y1y2y3y4 is less than certainly equal to 4, obtains lists at different levels
The value of position;By the digit order number in the value of units at different levels successively from a, ten, hundred, kilobit traversal, taken out respectively from the first mapping table
The corresponding Chinese-character digital of each digit order number, then unit quantifier (ten, hundred, thousand) are added since ten, units correspondences at different levels in spellings
Chinese character, the corresponding Chinese character of value of units at different levels can be obtained;Wherein, when being converted to every grade of unit, if y1!=
0&&y2==0&&y4!=0 explanation trillion has hundred million grades of value not have value after value and hundred million, then hundred million whole zero paddings, if y2!=0, when
When y2 length is less than four, " 0 " polishing four is mended from left to right, and y1 conversion method is called to obtain the Chinese figure Y2 after y2 conversion,
Similarly the processing of y3 obtains Y3 as y2, the processing for y4, if y4!=0&& (y1!=0 | | y2!=0 | | y3!=0)
Y4 is handled by y2, y3 mode, if y4!=0&& (y1==0 | | y2==0 | | y3==0) be directly converted to Contemporary Digital
Chinese figure, subsequent not need to mend unit, if y4==0, direct zero padding, centralized system processing y4 obtains Y4, finally turns
The character string of change is Y1Y2Y3Y4.
In any of the above-described embodiment, it is preferable that converting unit 508 is also used to: judgement conversion after Chinese character string with
10 beginnings, if so, replacing with ten for 10;Whether the Chinese character string after judging conversion is with zero ending, if so, by zero
Replace with null character;Whether comprising continuous multiple zero in Chinese character string after judging conversion, if so, by continuous multiple zero
Replace with one zero.
In this embodiment, if " 10 " of beginning are replaced with " ten " with " 10 " beginning by Y1Y2Y3Y4, if
" zero " of ending is replaced with null character with " zero " ending by Y1Y2Y3Y4, finally will be continuous in Y1Y2Y3Y4 using canonical
Multiple " zero " replace with one " zero ", and the Chinese figure that Arabic numerals are converted to can be obtained.
In any of the above-described embodiment, it is preferable that converting unit 508 is also used to: according to the second mapping table by financial character
String is mutually converted with Chinese character string.
In this embodiment, if to obtain financial number, successively each character in Chinese figure is mapped from second
Corresponding finance number replacement is taken out in table.
As shown in fig. 6, the schematic diagram of computer equipment according to an embodiment of the invention.Wherein, which sets
Standby 1, including memory 12, processor 14 and it is stored in the computer program that can be run on memory 12 and on processor 14,
Processor 14 is used to execute the step of conversion such as the digit strings in above-mentioned any embodiment.
Computer equipment 1 provided by the invention, the processor 14 for being included is for executing as in above-mentioned any embodiment
Digit strings conversion the step of, thus the conversion that the computer equipment 1 can be realized the digit strings whole has
Beneficial effect, repeats no more.
Another aspect of the present invention embodiment provides a kind of computer readable storage medium, is stored thereon with computer
Program realizes the step of the conversion such as the digit strings in above-mentioned any embodiment when computer program is executed by processor
Suddenly.
Computer readable storage medium provided by the invention, the realization when computer program stored thereon is executed by processor
As digit strings in above-mentioned any embodiment conversion the step of, thus the computer readable storage medium can be realized
The whole beneficial effect of the conversion of the digit strings, repeats no more.
The foregoing is only a preferred embodiment of the present invention, is not intended to restrict the invention, for the skill of this field
For art personnel, the invention may be variously modified and varied.All within the spirits and principles of the present invention, made any to repair
Change, equivalent replacement, improvement etc., should all be included in the protection scope of the present invention.
Claims (18)
1. a kind of conversion method of digit strings characterized by comprising
Construct Hash Map;
Digit strings are received, determine the type of the digit strings;
Target type is obtained, judges whether the type is consistent with the target type;
If inconsistent, according to the Hash Map, the type of the digit strings is converted into target type.
2. the conversion method of digit strings according to claim 1, which is characterized in that
The digit strings include: Chinese character string, Arabic character string, financial character string.
3. the conversion method of digit strings according to claim 2, which is characterized in that the building Hash Map
Step, comprising:
Using the key-value pair of the first mapping table storage Chinese numbers and Arabic numerals;
The corresponding Chinese numbers of finance number are stored using the second mapping table;
The corresponding Arabic numerical value of unit quantifiers at different levels is stored using third mapping table.
4. the conversion method of digit strings according to any one of claim 1 to 3, which is characterized in that by the number
The step of type of word character string is converted to the target type, comprising: the Chinese character string is converted into the Arab
Character string:
The Chinese character string is divided into integer-bit Z1 and decimal place Z2;
Divide the integer-bit Z1 according to unit quantifiers at different levels, obtains unit sections at different levels;
The value of the unit section at different levels is calculated, then is added to obtain the corresponding Arabic character string z1 of the integer-bit Z1;
Traverse each character in the decimal place Z2, taken out from first mapping table each character it is corresponding I
Uncle's number, and it is spliced into character string z2 in order;
Arabic character string after then converting are as follows: z1.z2.
5. the conversion method of digit strings according to claim 4, which is characterized in that calculate the unit sections at different levels
The step of value, comprising:
The successively Chinese numbers before taking out the unit quantifier in the unit sections at different levels, take out from first mapping table
The corresponding Arabic numerals of the Chinese numbers, then the corresponding Arab of the unit quantifier is taken out from the third mapping table
Numerical value is multiplied obtains the numerical value of the unit section at different levels respectively.
6. the conversion method of digit strings according to claim 4, which is characterized in that by the class of the digit strings
Type is converted to the step of target type, further includes: the Arabic character string is converted to the Chinese character string:
The Arabic character string is divided into integer-bit and decimal place;
The integer-bit is cut from left to right according to every 4-digit number, obtains the value of units at different levels;
The digit order number in the value of the unit at different levels is traversed, it is corresponding to take out each digit order number respectively from first mapping table
Chinese numbers, then the unit quantifier is successively added since ten;
Character string after the addition unit quantifier is spelled into the above corresponding Chinese character of the unit at different levels, obtains the unit at different levels
It is worth corresponding Chinese character string;
The corresponding Chinese character string of the value of the units at different levels is stitched together to get the Chinese character string to after converting.
7. the conversion method of digit strings according to claim 6, which is characterized in that the conversion method further include:
Whether the Chinese character string after judging the conversion is with 10 beginnings, if so, replacing with ten for described 10;
Whether the Chinese character string after judging the conversion is with zero ending, if so, replacing with null character for described zero;
Whether comprising continuous multiple zero in Chinese character string after judging the conversion, if so, will continuous multiple zero replacements
It is one zero.
8. the conversion method of digit strings according to claim 7, which is characterized in that the conversion method further include:
The financial character string is mutually converted with the Chinese character string according to second mapping table.
9. a kind of converting system of digit strings characterized by comprising
Construction unit, for constructing Hash Map;
Receiving unit determines the type of the digit strings for receiving digit strings;
Judging unit judges whether the type is consistent with the target type for obtaining target type;
If inconsistent, converting unit, for the type of the digit strings being converted to described according to the Hash Map
Target type.
10. the converting system of digit strings according to claim 9, which is characterized in that
The digit strings include: Chinese character string, Arabic character string, financial character string.
11. the converting system of digit strings according to claim 10, which is characterized in that the construction unit, specifically
For:
Using the key-value pair of the first mapping table storage Chinese numbers and Arabic numerals;
The corresponding Chinese numbers of finance number are stored using the second mapping table;
The corresponding Arabic numerical value of unit quantifiers at different levels is stored using third mapping table.
12. the converting system of the digit strings according to any one of claim 9 to 11, which is characterized in that described turn
Unit is changed, for the Chinese character string to be converted to the Arabic character string:
The Chinese character string is divided into integer-bit Z1 and decimal place Z2;
Divide the integer-bit Z1 according to unit quantifiers at different levels, obtains unit sections at different levels;
The value of the unit section at different levels is calculated, then is added to obtain the corresponding Arabic character string z1 of the integer-bit Z1;
Traverse each character in the decimal place Z2, taken out from first mapping table each character it is corresponding I
Uncle's number, and it is spliced into character string z2 in order;
Arabic character string after then converting are as follows: z1.z2.
13. the converting system of digit strings according to claim 12, which is characterized in that described to calculate the lists at different levels
The step of value of position section, comprising:
The successively Chinese numbers before taking out the unit quantifier in the unit sections at different levels, take out from first mapping table
The corresponding Arabic numerals of the Chinese numbers, then the corresponding Arab of the unit quantifier is taken out from the third mapping table
Numerical value is multiplied obtains the numerical value of the unit section at different levels respectively.
14. the converting system of digit strings according to claim 12, which is characterized in that the converting unit is also used
In the Arabic character string is converted to Chinese character string:
The Arabic character string is divided into integer-bit and decimal place;
The integer-bit is cut from left to right according to every 4-digit number, obtains the value of units at different levels;
The digit order number in the value of the unit at different levels is traversed, it is corresponding to take out each digit order number respectively from first mapping table
Chinese numbers, then the unit quantifier is successively added since ten;
Character string after the addition unit quantifier is spelled into the above corresponding Chinese character of the unit at different levels, obtains the unit at different levels
It is worth corresponding Chinese character string;
The corresponding Chinese character string of the value of the units at different levels is stitched together to get the Chinese character string to after converting.
15. the conversion method of digit strings according to claim 14, which is characterized in that the converting unit is also used
In: the Chinese character string after judging the conversion is with 10 beginnings, if so, replacing with ten for described 10;
Whether the Chinese character string after judging the conversion is with zero ending, if so, replacing with null character for described zero;
Whether comprising continuous multiple zero in Chinese character string after judging the conversion, if so, will continuous multiple zero replacements
It is one zero.
16. the converting system of digit strings according to claim 15, which is characterized in that the converting unit is also used
In:
The financial character string is mutually converted with the Chinese character string according to second mapping table.
17. a kind of computer equipment, including memory, processor and it is stored on the memory and can be on the processor
The computer program of operation, which is characterized in that the processor is for executing such as any one of claims 1 to 8 the method
The step of.
18. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program
It is realized when being executed by processor such as the step of any one of claims 1 to 8 the method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810109907.XA CN110119495A (en) | 2018-02-05 | 2018-02-05 | Conversion method, system, computer equipment and the medium of digit strings |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810109907.XA CN110119495A (en) | 2018-02-05 | 2018-02-05 | Conversion method, system, computer equipment and the medium of digit strings |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110119495A true CN110119495A (en) | 2019-08-13 |
Family
ID=67519154
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810109907.XA Pending CN110119495A (en) | 2018-02-05 | 2018-02-05 | Conversion method, system, computer equipment and the medium of digit strings |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110119495A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111625520A (en) * | 2020-06-08 | 2020-09-04 | 成都信息工程大学 | Universal mapping method and system for field types of heterogeneous database |
CN113807056A (en) * | 2021-09-23 | 2021-12-17 | 北京林业大学 | Method, device and equipment for correcting error of document name sequence number |
CN115828918A (en) * | 2022-12-09 | 2023-03-21 | 中国人民解放军国防科技大学 | Equipment name entity resolution method |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0267676A (en) * | 1988-09-01 | 1990-03-07 | Ricoh Co Ltd | Chinese numeral conversion processor |
CN101196879A (en) * | 2006-12-07 | 2008-06-11 | 珠海金山软件股份有限公司 | Conversion device and method for number to RMB |
CN101196878A (en) * | 2006-12-07 | 2008-06-11 | 珠海金山软件股份有限公司 | Device and mode for commuting value into expression mode correlative to language |
CN101470724A (en) * | 2007-12-25 | 2009-07-01 | 英业达股份有限公司 | Character conversion system and method |
CN101661462A (en) * | 2009-07-17 | 2010-03-03 | 北京邮电大学 | Four-layer structure Chinese text regularized system and realization thereof |
CN101984489A (en) * | 2010-11-08 | 2011-03-09 | 无敌科技(西安)有限公司 | Method for realizing numerical pronunciation of Chinese content by using Chinese TTS |
CN105989057A (en) * | 2015-02-06 | 2016-10-05 | 北京中搜网络技术股份有限公司 | Conversion method of numeral type search string based on string operation |
-
2018
- 2018-02-05 CN CN201810109907.XA patent/CN110119495A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0267676A (en) * | 1988-09-01 | 1990-03-07 | Ricoh Co Ltd | Chinese numeral conversion processor |
CN101196879A (en) * | 2006-12-07 | 2008-06-11 | 珠海金山软件股份有限公司 | Conversion device and method for number to RMB |
CN101196878A (en) * | 2006-12-07 | 2008-06-11 | 珠海金山软件股份有限公司 | Device and mode for commuting value into expression mode correlative to language |
CN101470724A (en) * | 2007-12-25 | 2009-07-01 | 英业达股份有限公司 | Character conversion system and method |
CN101661462A (en) * | 2009-07-17 | 2010-03-03 | 北京邮电大学 | Four-layer structure Chinese text regularized system and realization thereof |
CN101984489A (en) * | 2010-11-08 | 2011-03-09 | 无敌科技(西安)有限公司 | Method for realizing numerical pronunciation of Chinese content by using Chinese TTS |
CN105989057A (en) * | 2015-02-06 | 2016-10-05 | 北京中搜网络技术股份有限公司 | Conversion method of numeral type search string based on string operation |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111625520A (en) * | 2020-06-08 | 2020-09-04 | 成都信息工程大学 | Universal mapping method and system for field types of heterogeneous database |
CN111625520B (en) * | 2020-06-08 | 2023-06-06 | 成都信息工程大学 | General mapping method and system for field types of heterogeneous database |
CN113807056A (en) * | 2021-09-23 | 2021-12-17 | 北京林业大学 | Method, device and equipment for correcting error of document name sequence number |
CN113807056B (en) * | 2021-09-23 | 2023-11-14 | 北京林业大学 | Document name sequence error correction method, device and equipment |
CN115828918A (en) * | 2022-12-09 | 2023-03-21 | 中国人民解放军国防科技大学 | Equipment name entity resolution method |
CN115828918B (en) * | 2022-12-09 | 2024-02-02 | 中国人民解放军国防科技大学 | Equipment name entity resolution method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11055287B2 (en) | Eigenvalue-based data query | |
CN110119495A (en) | Conversion method, system, computer equipment and the medium of digit strings | |
CN104021123B (en) | method and system for data migration | |
CN105095237B (en) | Method and apparatus for the pattern for generating non-relational database | |
CN103049458B (en) | A kind of method and system revising user thesaurus | |
CN101876965B (en) | Method and system used for processing text | |
CN105630803B (en) | The method and apparatus that Document image analysis establishes index | |
CN110263130A (en) | Page info processing method, device and storage medium | |
CN105959231A (en) | Agent port communication flow control method and redundant device | |
CN109902090A (en) | Field name acquisition methods and device | |
US11467905B1 (en) | Stripe merging method and system based on erasure codes | |
CN111831785A (en) | Sensitive word detection method and device, computer equipment and storage medium | |
CN108132917B (en) | Document error correction marking method | |
CN106802927A (en) | A kind of date storage method and querying method | |
TWI608435B (en) | A method of using blockchain to realize tax calculation in transaction process | |
CN104123347B (en) | A kind of data applied to BOSS systems delete method and system again | |
CN109101368A (en) | A kind of data processing method and device | |
CN112506869A (en) | File processing method, device and system | |
CN106569986B (en) | Character string replacing method and device | |
CN106844233A (en) | A kind of router service data caching method and system based on Hash table | |
US11216438B2 (en) | Database creation and collision reduction | |
US11755583B2 (en) | Database creation using domain-specific information | |
CN105812258B (en) | A kind of data processing method and device | |
CN112269784A (en) | Hash table structure based on hardware realization and inserting, inquiring and deleting method | |
CN115185981B (en) | Data duplication checking method and device considering super-large table |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190813 |
|
RJ01 | Rejection of invention patent application after publication |