CN113779932B - Digital formatting method, device, terminal equipment and storage medium - Google Patents

Digital formatting method, device, terminal equipment and storage medium Download PDF

Info

Publication number
CN113779932B
CN113779932B CN202110975652.7A CN202110975652A CN113779932B CN 113779932 B CN113779932 B CN 113779932B CN 202110975652 A CN202110975652 A CN 202110975652A CN 113779932 B CN113779932 B CN 113779932B
Authority
CN
China
Prior art keywords
character
character string
string
characters
formatting
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.)
Active
Application number
CN202110975652.7A
Other languages
Chinese (zh)
Other versions
CN113779932A (en
Inventor
李奇峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Mingyuan Cloud Technology Co Ltd
Original Assignee
Shenzhen Mingyuan Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Mingyuan Cloud Technology Co Ltd filed Critical Shenzhen Mingyuan Cloud Technology Co Ltd
Priority to CN202110975652.7A priority Critical patent/CN113779932B/en
Publication of CN113779932A publication Critical patent/CN113779932A/en
Application granted granted Critical
Publication of CN113779932B publication Critical patent/CN113779932B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/111Mathematical or scientific formatting; Subscripts; Superscripts

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Mathematical Analysis (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Algebra (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The application is applicable to the technical field of data processing, and provides a digital formatting method, a digital formatting device, terminal equipment and a storage medium, wherein the digital formatting method comprises the following steps: when the numerical value of the number meets a preset condition, determining a first character string corresponding to an integer part of the number, wherein the preset condition is that the numerical value of the number is more than or equal to ten thousand, or the numerical value of the number is less than or equal to minus ten thousand; starting from the character corresponding to the digit of the number, sequentially numbering the positions of the characters in the first character string according to the sequence from the low digit to the high digit; inserting a separator into the first character string according to the position numbers of the characters in the first character string to obtain a second character string; and formatting the number according to the second character string. The scheme can solve the problem that the long number cannot be automatically converted according to the counting unit, and is convenient for people to read the long number.

Description

Digital formatting method, device, terminal equipment and storage medium
Technical Field
The present application belongs to the technical field of data processing, and in particular, relates to a digital formatting method, a digital formatting device, a terminal device and a storage medium.
Background
In daily life, we can always see various types of long numbers in various software and web pages, such as billions and tens of millions of values, when we read the long numbers, in order to prevent misreading, we often need to manually or in the brain convert the long numbers according to the count units, but the conversion of the count units cannot be clearly performed on the long numbers, which brings inconvenience to the life of people. Therefore, it is desirable to provide a method for digital formatting so as to automatically convert long numbers into a certain count unit.
Disclosure of Invention
The embodiment of the application provides a digital formatting method, a digital formatting device, terminal equipment and a storage medium, which can solve the problem that long digits cannot be automatically converted according to a counting unit.
A first aspect of an embodiment of the present application provides a digital formatting method, including:
when the numerical value of the number meets a preset condition, determining a first character string corresponding to an integer part of the number, wherein the preset condition is that the numerical value of the number is more than or equal to ten thousand, or the numerical value of the number is less than or equal to minus ten thousand;
Starting from the character corresponding to the digit of the number, sequentially numbering the positions of the characters in the first character string according to the sequence from the low digit to the high digit;
inserting a separator into the first character string according to the position numbers of the characters in the first character string to obtain a second character string;
And formatting the number according to the second character string.
A second aspect of an embodiment of the present application provides a digital formatting device, including:
the character string determining module is used for determining a first character string corresponding to an integer part of the number when the numerical value of the number meets a preset condition, wherein the preset condition is that the numerical value of the number is more than or equal to ten thousand or the numerical value of the number is less than or equal to minus ten thousand;
the number acquisition module is used for sequentially numbering the positions of the characters in the first character string from the characters corresponding to the digits of the digits according to the sequence from the lower digits to the higher digits;
The inserting module is used for inserting separators into the first character string according to the position numbers of the characters in the first character string to obtain a second character string;
And the formatting module is used for formatting the numbers according to the second character string.
A third aspect of an embodiment of the present application provides a terminal device, including: a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the digital formatting method according to the first aspect described above when executing the computer program.
A fourth aspect of an embodiment of the present application provides a computer readable storage medium storing a computer program which, when executed by a processor, implements the digital formatting method described in the first aspect above.
A fifth aspect of an embodiment of the application provides a computer program product for, when run on a terminal device, causing the terminal device to perform the digital formatting method as described in the first aspect above.
Compared with the prior art, the embodiment of the application has the beneficial effects that: when the number of the number is more than or equal to ten thousand or less than minus ten thousand, the number can be considered to be a long number, so that the number needs to be formatted in order to avoid error reading, the method comprises the steps of firstly determining a first character string corresponding to an integer part of the number, secondly sequentially numbering the positions of the characters in the first character string from the low number to the high number according to the sequence from the low number to the high number, inserting a separator into the first character string according to the position number of each character to obtain a second character string, separating the numbers according to a counting unit by the separator, and finally formatting the number according to the second character string, so that the long number can be automatically converted according to the counting unit, and further people can read the long number conveniently.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments or the description of the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a digital formatting method according to a first embodiment of the present application;
fig. 2 is a flow chart of a digital formatting method according to a second embodiment of the present application;
fig. 3 is a schematic structural diagram of a digital formatting device according to a third embodiment of the present application;
fig. 4 is a schematic structural diagram of a terminal device according to a fourth embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in the present description and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Furthermore, the terms "first," "second," "third," and the like in the description of the present specification and in the appended claims, are used for distinguishing between descriptions and not necessarily for indicating or implying a relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
It should be understood that, the sequence number of each step in this embodiment does not mean the execution sequence, and the execution sequence of each process should be determined by its function and internal logic, and should not limit the implementation process of the embodiment of the present application in any way.
Various numbers can be frequently seen in various software, web pages and printed documents, when long numbers are encountered, people cannot directly convert the long numbers into units, in Chinese culture, when long numbers are encountered, ten thousands or hundred million counting units are usually adopted, the long numbers cannot be converted according to a certain counting unit, and a certain difficulty is brought to people for reading the long numbers.
Therefore, the embodiment provides a digital formatting method which can be applied to various computing devices, such as a server or a personal computer, and can automatically convert long numbers in various software, web pages and printed documents according to a certain counting unit, so that the problem that people are difficult to read the long numbers is solved.
In order to illustrate the technical scheme of the application, the following description is given by specific examples.
Referring to fig. 1, a flowchart of a digital formatting method according to a first embodiment of the present application is shown, where the digital formatting method shown in fig. 1 may include the following steps:
step 101, when the numerical value of the number meets the preset condition, determining a first character corresponding to the integer part of the number.
The preset condition is that the number value of the number is greater than or equal to ten thousands, or the number value of the number is less than or equal to minus ten thousands, and the number is considered to be a long number when the number of the number is greater than 5, that is, the number value of the number is greater than or equal to ten thousands, or the number value of the number is less than or equal to minus ten thousands, because the number count unit comprises one, ten, hundred, ten thousand, hundred thousand, million, ten thousands and the like, and the basic count unit is one, ten hundred, thousand, ten thousands, and the like.
In the embodiment of the present application, the number may be a number having only an integer part, such as 123456, or may be a number in which an integer part is combined with a fractional part, such as 123456.789. When the number is only an integer part, only the integer part is needed to be converted; when the number is the combination of the integer part and the decimal part, the minimum counting unit is one, so when the number is converted according to a certain counting unit, the decimal part is not required to be converted, and only the integer part is required to be converted. Therefore, when the numerical value of the number meets the preset condition, firstly converting the number into a corresponding character string, storing the character string corresponding to the number into a variable, determining a first character string corresponding to the integer part of the number, and processing the first character string.
In one possible implementation manner, when the numerical value of the number meets a preset condition, determining the first character string corresponding to the integer part of the number includes:
when the numerical value of the number meets a preset condition, detecting whether an identifier exists in a third character string corresponding to the number, wherein the identifier is used for separating an integer part from a decimal part;
if the identifier exists in the third character string, forming a first character string based on the character, which is positioned before the identifier, of the third character string;
And if the identifier does not exist in the third character string, determining the third character string as the first character string.
In the embodiment of the application, when the numerical value of the number is greater than or equal to ten thousand, or the numerical value of the number is less than or equal to minus ten thousand, the number is converted into a third character string, the third character string is stored in a variable, whether an identifier (such as a decimal point) separating an integer part from a decimal part is included in the third character string is detected, if the decimal point exists in the third character string, a first character string corresponding to the digital integer part of the character string before the decimal point is obtained, and if the decimal point does not exist in the third character string, the non-decimal part of the number is indicated, and the first character string corresponding to the digital integer part of the third character string converted by the number can be directly determined.
Illustratively, when the number is 123456, the converted string is "123456", and the decimal point does not exist in the string, the first string corresponding to the integer part of the number is determined to be "123456"; when the number is 123456.789, the converted character string is "123456.789", and if a decimal point exists in the character string, the character string before the decimal point (i.e., "123456") is determined to be the first character string corresponding to the integer part of the number.
Step 102, starting from the character corresponding to the digit of the number, sequentially numbering the positions of the characters in the first character string from the lower digit to the higher digit.
In the embodiment of the present application, the first string is a string corresponding to an integer part of the digits, and if the digits are converted into units according to the count unit of ten thousand, the unit conversion of ten thousand is required to be performed from one bit to every 4 bits. Since the number is closely related to the position of each character in the first character string when converting the number into the count unit, it is necessary to number the position of each character in the first character string.
Specifically, firstly, the character corresponding to each digit of the number is acquired, and secondly, starting from the character corresponding to the digit of the number, the position numbering is sequentially carried out on the characters corresponding to the lower digits to the higher digits according to the sequence from the lower digits to the higher digits in the digit sequence table.
For example, for the number 1234567, the character string corresponding to the number is "1234567", the character corresponding to the number is "7", the sequence of arranging the character strings from the lower number to the higher number is "7654321", the position numbers of the characters in the character string are sequentially obtained according to the sequence of arranging the characters, the position number corresponding to "7" is ①, the position number corresponding to "6" is ②, the position number corresponding to "5" is ③, the position number corresponding to "4" is ④, the position number corresponding to "3" is ⑤, the position number corresponding to "2" is ⑥, and the position number corresponding to "1" is ⑦.
In one possible embodiment, starting from a character corresponding to a digit of the number, sequentially numbering the positions of the characters in the first string in the order from the lower digit to the higher digit, including:
Sequentially extracting characters corresponding to each digit of the digits from the first character string according to the sequence from the lower digit to the higher digit from the characters corresponding to the digits of the digits;
And carrying out position numbering on the characters corresponding to each extracted digit according to the extraction sequence.
In the embodiment of the present application, the character corresponding to each digit extracted in sequence is stored in a variable (for example, in a variable buffer, different from the variable stored after the digits are converted into the third character string), and the position number of the character corresponding to each digit extracted in sequence is sequentially performed according to the extraction sequence, so as to obtain the position number of the character corresponding to each digit of the digits, for example, for the digits 1234567, the character string "1234567" corresponding to the digits is stored in a variable, and the position numbers corresponding to the digits are ⑦⑥⑤④③②① according to the extraction sequence.
Step 103, according to the position numbers of the characters in the first character string, inserting separators into the first character string to obtain a second character string.
In the embodiment of the application, the second character string is obtained by inserting the separator into the first character string, and specifically, each character in the first character string can be spaced according to the position number of each character in the first character string.
Specifically, since the position numbers of the characters in the first character string are numbered according to the extraction order, when the extracted characters are stored in the variable buffer, in order to ensure that the character order of the first character string is not changed, the extracted characters should be sequentially inserted into the variable buffer according to the reverse order of the extraction order, further the first character string is stored in the variable buffer, and then the separator is inserted into the first character string, so as to obtain the second character string.
It should be appreciated that the selection of a separator cannot be ambiguous, for example: the application does not need to be a symbol related to the mixed operation of English comma and English period (decimal point), the separator is a printable character and is easy to identify, and the position of the separator can be above the number or at the position of the lower mark.
In one possible implementation manner, according to the position number of each character in the first character string, inserting a separator into the first character string to obtain a second character string, including:
detecting whether a first character exists in the first character string, wherein the first character refers to a character with the position number being a multiple of 4;
If the first character exists in the first character string, inserting a separator between the first character and the second character to obtain a second character string, wherein the second character is a character adjacent to the first character in the first character string and the position number is behind the position number of the first character.
In the embodiment of the application, when the numbers are converted into the units according to the ten thousand counting units, each character in the character string corresponding to the numbers can be separated in a mode of 4 groups. When the numbers are to be converted into units according to the thousands of counting units, the characters in the character strings corresponding to the numbers can be separated in a group of 3, namely, when the numbers are to be converted into units according to any counting unit, the character strings corresponding to the numbers can be separated in a group of characters corresponding to the counting units.
For example, when the digits 1234567 are converted into units according to the count unit of "ten thousand", the position number corresponding to the digits 1234567 is obtained, the character with the multiple of the position number of 4 is detected, the character with the multiple of the position number of 4 is obtained as the character "4" with the number of ④ (i.e., the first character), the character with the second character adjacent to the character "4" and with the position number of ④ is obtained as the character "3" with the position number of ⑤, and the second character string "123'4567" is obtained after the separator is inserted between the character "4" and the character "3".
It should be understood that, in the embodiment of the present application, the number of the first characters is an integer greater than zero, that is, the characters satisfying the multiple of the position number 4 are all the first characters.
Step 104, formatting the digital according to the second character string.
In the embodiment of the present application, if the identifier does not exist in the third string after the number conversion, the second string in the variable buffer is the result after the number is formatted, for example, the second string in the variable buffer is "123'4567", and the result after the corresponding number is formatted is 123'4567.
If the identifier exists in the third character string after the digit conversion, namely the decimal part exists in the digits, the character string (namely the fourth character string) and the identifier corresponding to the decimal part are obtained from the variable storing the third character string, the fourth character string and the identifier are added into the variable storing the second character string, and the fourth character string, the identifier and the second character string are formatted according to a digit combination rule. The numerical combination rule means that the fourth character string, the identifier and the second character string are combined according to the sequence of the second character string, the identifier and the fourth character string.
Illustratively, for the case of number 1234567.89, the number 1234567.89 is converted into a string of "1234567.89", the second string is "123'4567", the identifier is "," the fourth string is "89", the second string "123'4567" is stored in the variable buffer, and the fourth string and the identifier are added to the variable buffer, so that the result after formatting is "123'4567.89". According to the formatted result, people can clearly and directly obtain the number which is one hundred twenty-three thousand four thousand five hundred sixty seven points eight nine, so that the problem that people are difficult to read long numbers is solved.
In one possible implementation manner, a memory buffer area may be preset, the character string corresponding to the integer part is stored in the preset memory buffer area, when the first character exists in the character string corresponding to the integer part, the separator is added at the corresponding position of the preset memory buffer area, after all separators are added at the corresponding position of the preset memory buffer area, the second character string is obtained, if the number has the decimal part, the character string corresponding to the decimal part and the identifier are added to the preset memory buffer area, and formatting processing is performed on the second character string, the character string corresponding to the decimal part and the identifier in the preset memory buffer area according to a number combination rule. If the number does not have the decimal part, the second character string in the preset memory buffer area is the result after formatting.
In the embodiment of the application, when the numerical value of the number is more than or equal to ten thousand or less than minus ten thousand, the number can be considered to be a long number, in order to avoid misreading the number, formatting the number is needed, and the method comprises the steps of firstly determining a first character string corresponding to an integer part of the number, secondly sequentially numbering the positions of the characters in the first character string from a low digit to a high digit according to the sequence from the low digit to the high digit, inserting a separator in the first character string according to the position number of each character to obtain a second character string, separating the number according to a counting unit by the separator, and finally formatting the number according to the second character string, so that the long number can be automatically converted according to the counting unit.
Referring to fig. 2, a flow chart of a digital formatting method according to a second embodiment of the present application is shown, where the digital formatting method shown in fig. 2 may include the following steps:
In step 201, when the numerical value of the number meets a preset condition, a first character corresponding to an integer part of the number is determined.
Step 202, starting from the character corresponding to the digit of the number, sequentially numbering the positions of the characters in the first character string from the lower digit to the higher digit.
Steps 201 to 202 of this embodiment are the same as steps 101 to 102 of the foregoing embodiment, and can be referred to each other, and the description of this embodiment is omitted here.
Step 203, reorganizing each character with the position number according to the sequence from the low digit to the high digit to obtain a continuous character string.
In the embodiment of the present application, the position numbering of each character is performed according to the extraction order, so that when the characters corresponding to each digit of the digits are sequentially extracted from the first character string according to the order from the lower digit to the higher digit, each extracted character can be directly stored in the variable buffer according to the extraction order, and at this time, the continuous character string composed of each character stored in the variable buffer according to the extraction order is the character string after the first character string is turned over.
For example, if the number is 1234567, the corresponding first string is "1234567", the sequentially extracted characters are "7", "6", "5", "4", "3", "2", and "1" in the order of the low-order to high-order extraction, and each character is stored in the variable buffer, that is, each character is reorganized in the order of the low-order to high-order, and at this time, the consecutive string stored in the variable buffer is "7654321", that is, the string after the first string is flipped.
It should be understood that, in the embodiment of the present application, each character in the first string may be stored in a variable buffer directly according to the extraction sequence while each character in the first string is numbered according to the extraction sequence, so that each character may be recombined to obtain a flipped first string (i.e. a continuous string), and after the position is numbered, the position is recombined according to the sequence from the low digit to the high digit of the position number to obtain the continuous string.
Step 204, inserting separator into the continuous character string according to the position number of each character in the continuous character string to obtain a second character string.
In the embodiment of the application, the second character string is obtained by inserting the separator into the continuous character string, and specifically, each character in the continuous character string can be spaced according to the position number of each character in the continuous character string.
In one possible implementation manner, inserting separators into the continuous character strings according to the position numbers of the characters in the continuous character strings to obtain second character strings, including:
detecting whether a first character exists in the continuous character string, wherein the first character refers to a character with the position number being a multiple of 4;
If the first character exists in the continuous character string, inserting a separator between the first character and a third character, wherein the third character is a character adjacent to the first character in the continuous character string and the position number is behind the position number of the first character;
and turning over the continuous character strings after the separators are inserted, so as to obtain a second character string.
In the embodiment of the present application, the position number of each character in the continuous character string corresponds to the position number of each character in the first character string, for example, the determined first character string is "1234567", the recombined continuous character string is "7654321", and the position number corresponding to "7" in the first character string is ①, so the position number corresponding to "7" in the continuous character string is ①.
Specifically, whether a first character exists in the continuous character strings is detected, if the first character exists, a separator is inserted between the first character and the third character, after all separators are inserted, the continuous character strings after the separators are inserted are turned over, and a second character string is obtained, wherein the second character string is identical to the first character string inserted with the separators.
For example, the first string of digits is "1234567", the recombined continuous string is "7654321", the position number corresponding to each character in the continuous string is ①②③④⑤⑥⑦, the character having a multiple of the position number of 4 is "4" (i.e., the first character) of number ④, the third character is adjacent to the character "4" and the character having a position number of ④ is obtained, i.e., the character having a number of ⑤ is "3", the continuous string after inserting the separator is "7654'321" after inserting the separator is obtained after inserting the separator between the character "4" and the character "3", and the continuous string is regarded as the string after inverting the first string, so that the continuous string after inserting the separator is required to be inverted after inserting the separator to obtain the second string, and the obtained second string is "123' 4567.
Step 205, formatting the digital code according to the second string.
The step 205 of this embodiment is the same as the step 104 of the previous embodiment, and can be referred to each other, and the description of this embodiment is omitted here.
Compared with the embodiment, the embodiment of the application directly stores the extracted characters in the variable buffer or the preset memory buffer according to the extraction sequence (i.e. the position number), when the characters are inserted into the character string without a fixed insertion rule (for example, the characters are inserted into the corresponding positions in the character string), the characters are usually directly inserted into the tail ends of the character string, so that the characters are stored in the variable buffer or the preset memory buffer according to the extraction sequence, the character strings are recombined to obtain continuous character strings, the operation of inserting separators is performed on the continuous character strings, the continuous character strings are turned over after the separator insertion is completed, so that a second character string is obtained, the formatting process is strict, errors are not easy to occur, and the long numbers can be converted according to the counting units better.
Referring to fig. 3, a schematic structural diagram of a digital formatting device according to a third embodiment of the present application is shown, and for convenience of explanation, only a portion related to the embodiment of the present application is shown.
The digital formatting device specifically may include the following modules:
The character string determining module 301 is configured to determine a first character string corresponding to an integer part of the digits when the numerical value of the digits meets a preset condition, where the preset condition is that the numerical value of the digits is greater than or equal to ten thousand, or the numerical value of the digits is less than or equal to minus ten thousand;
The number obtaining module 302 is configured to sequentially number, from a character corresponding to a digit of the number, positions of each character in the first string in an order from a lower digit to a higher digit;
an inserting module 303, configured to insert a separator into the first string according to the position number of each character in the first string, so as to obtain a second string;
the formatting module 304 is configured to format the digital code according to the second string.
In the embodiment of the present application, the string determination module 301 may specifically include the following sub-modules:
The first detection submodule is used for detecting whether an identifier exists in a third character string corresponding to the number when the numerical value of the number meets a preset condition, and the identifier is used for separating an integer part from a decimal part;
the first determining submodule is used for forming a first character string based on characters positioned before the identifier in the third character string if the identifier exists in the third character string;
And the second determining submodule determines the third character string as the first character string if the identifier does not exist in the third character string.
In the embodiment of the present application, for the case that the identifier exists in the third string, the formatting module 304 may specifically include the following sub-modules:
A character string forming sub-module for forming a fourth character string based on the character located after the identifier in the third character string, the fourth character string being a character string corresponding to the decimal part;
and the combination sub-module is used for formatting the fourth character string, the identifier and the second character string according to a digital combination rule.
In the embodiment of the application, the digital formatting device specifically may further include the following modules:
The first storage module is used for storing the fourth character string, the identifier and the second character string into a preset memory buffer area under the condition that the identifier exists in the third character string;
And the second storage module is used for storing the second character string into a preset memory buffer area under the condition that the identifier does not exist in the third character string.
In the embodiment of the present application, the number obtaining module 302 may specifically include the following sub-modules:
The extraction submodule is used for sequentially extracting the characters corresponding to each digit of the digits from the first character string according to the sequence from the lower digit to the higher digit from the characters corresponding to the digits of the digits;
And the coding sub-module is used for carrying out position numbering on the characters corresponding to each digit extracted in sequence according to the extraction sequence.
In the embodiment of the present application, the inserting module 303 may specifically include the following sub-modules:
the second detection submodule is used for detecting whether a first character exists in the first character string or not, wherein the first character refers to a character with the position number being a multiple of 4;
And the first inserting sub-module is used for inserting a separator between the first character and the second character to obtain a second character string if the first character exists in the first character string, wherein the second character is a character adjacent to the first character in the first character string and the position number is behind the position number of the first character.
In the embodiment of the application, the digital formatting device specifically may further include the following modules:
the recombination module is used for recombining the characters with the position numbers according to the sequence from the low digits to the high digits to obtain a continuous character string;
and the separation module is used for inserting separators into the continuous character strings according to the position numbers of the characters in the continuous character strings to obtain second character strings.
In the embodiment of the present application, the separation module may specifically include the following sub-modules:
a third detection sub-module, configured to detect whether a first character exists in the continuous character string, where the first character is a character with a position number that is a multiple of 4;
The second inserting sub-module is used for inserting a separator between the first character and a third character if the first character exists in the continuous character string, wherein the third character is a character adjacent to the first character in the continuous character string and the position number is behind the position number of the first character;
And the turnover sub-module is used for overturning the continuous character strings after the separators are inserted, so as to obtain a second character string.
The digital formatting device provided in the embodiment of the present application may be applied to the foregoing method embodiment, and details refer to the description of the foregoing method embodiment, which is not repeated herein.
Fig. 4 is a schematic structural diagram of a terminal device according to a fourth embodiment of the present application. As shown in fig. 4, the terminal device 400 of this embodiment includes: at least one processor 410 (only one shown in fig. 4), a memory 420, and a computer program 421 stored in the memory 420 and executable on the at least one processor 410, the processor 410 implementing the steps in any one of the digital formatting method embodiments described above when executing the computer program 421.
The terminal device 400 may be a computing device such as a desktop computer, a notebook computer, a palm computer, and a cloud server. The terminal device may include, but is not limited to, a processor 410, a memory 420. It will be appreciated by those skilled in the art that fig. 4 is merely an example of a terminal device 400 and is not limiting of the terminal device 400, and may include more or fewer components than shown, or may combine certain components, or different components, such as may also include input-output devices, network access devices, etc.
The Processor 410 may be a central processing unit (Central Processing Unit, CPU), the Processor 410 may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL processors, DSPs), application SPECIFIC INTEGRATED Circuits (ASICs), off-the-shelf Programmable gate arrays (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 420 may in some embodiments be an internal storage unit of the terminal device 400, such as a hard disk or a memory of the terminal device 400. The memory 420 may also be an external storage device of the terminal device 400 in other embodiments, such as a plug-in hard disk, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD) or the like, which are provided on the terminal device 400. Further, the memory 420 may also include both an internal storage unit and an external storage device of the terminal device 400. The memory 420 is used to store an operating system, application programs, boot Loader (Boot Loader), data, and other programs, such as program code of the computer program. The memory 420 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the apparatus/terminal device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical function division, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
The present application may also be implemented by a computer program product for implementing all or part of the steps of the above embodiments of the method, when the computer program product is run on a terminal device, for enabling the terminal device to execute the steps of the above embodiments of the method.
The above embodiments are only for illustrating the technical solution of the present application, and are not limited thereto. Although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (9)

1. A digital formatting method, the digital formatting method comprising:
when the numerical value of the number meets a preset condition, determining a first character string corresponding to an integer part of the number, wherein the preset condition is that the numerical value of the number is more than or equal to ten thousand, or the numerical value of the number is less than or equal to minus ten thousand;
Starting from the character corresponding to the digit of the number, sequentially numbering the positions of the characters in the first character string according to the sequence from the low digit to the high digit;
inserting a separator into the first character string according to the position numbers of the characters in the first character string to obtain a second character string;
formatting the number according to the second character string;
Wherein, before inserting the separator into the first character string according to the position number of each character in the first character string to obtain the second character string, the method further comprises:
recombining the characters with the positions numbered according to the sequence from the low digits to the high digits to obtain continuous character strings, wherein the continuous character strings are the character strings with the first character strings turned over;
correspondingly, the inserting a separator into the first character string according to the position number of each character in the first character string to obtain a second character string, including:
Inserting separators into the continuous character strings according to the position numbers of the characters in the continuous character strings to obtain second character strings;
wherein, according to the position numbers of the characters in the continuous character string, inserting separators in the continuous character string to obtain a second character string, comprising:
detecting whether a first character exists in the continuous character string, wherein the first character refers to a character with the position number being a multiple of 4;
if the first character exists in the continuous character string, inserting a separator between the first character and a third character, wherein the third character is a character adjacent to the first character in the continuous character string and the position number is behind the position number of the first character;
and turning over the continuous character strings after the separators are inserted, so as to obtain the second character string.
2. The method for formatting a number according to claim 1, wherein when the numerical value of the number satisfies a preset condition, determining a first character string corresponding to an integer part of the number includes:
When the numerical value of the number meets a preset condition, detecting whether an identifier exists in a third character string corresponding to the number, wherein the identifier is used for separating an integer part from a decimal part;
if the identifier exists in the third character string, the first character string is formed based on characters, located before the identifier, in the third character string;
And if the identifier does not exist in the third character string, determining that the third character string is the first character string.
3. The method of formatting a number according to claim 2, wherein said formatting said number from said second string in the presence of said identifier in said third string comprises:
Forming a fourth character string based on characters positioned behind the identifier in the third character string, wherein the fourth character string refers to a character string corresponding to the decimal part;
And formatting the fourth character string, the identifier and the second character string according to a digital combination rule.
4. The digital formatting method as in claim 3, wherein the digital formatting method further comprises:
storing the fourth character string, the identifier and the second character string into a preset memory buffer area under the condition that the identifier exists in the third character string;
and storing the second character string into the preset memory buffer area under the condition that the identifier does not exist in the third character string.
5. The method for formatting digits according to claim 1, wherein said sequentially numbering each character in said first string from a lower digit to a higher digit in order from said character corresponding to said digits, comprises:
Sequentially extracting characters corresponding to each digit of the digits from the first character string according to the sequence from the lower digit to the higher digit from the characters corresponding to the digits of the digits;
And carrying out position numbering on the characters corresponding to each digit extracted in sequence according to the extraction sequence.
6. The method for formatting a number as claimed in claim 1, wherein said inserting a separator into said first string according to the position number of each character in said first string to obtain a second string comprises:
detecting whether a first character exists in the first character string, wherein the first character refers to a character with the position number being a multiple of 4;
If the first character exists in the first character string, a separator is inserted between the first character and a second character to obtain a second character string, wherein the second character is a character adjacent to the first character in the first character string and the position number is behind the position number of the first character.
7. A digital formatting device, the digital formatting device comprising:
the character string determining module is used for determining a first character string corresponding to an integer part of the number when the numerical value of the number meets a preset condition, wherein the preset condition is that the numerical value of the number is more than or equal to ten thousand or the numerical value of the number is less than or equal to minus ten thousand;
the number acquisition module is used for sequentially numbering the positions of the characters in the first character string from the characters corresponding to the digits of the digits according to the sequence from the lower digits to the higher digits;
The inserting module is used for inserting separators into the first character string according to the position numbers of the characters in the first character string to obtain a second character string;
the formatting module is used for formatting the numbers according to the second character string;
The digital formatting device further comprises the following modules:
The recombination module is used for recombining the characters with the position numbers according to the sequence from the low digits to the high digits to obtain continuous character strings, wherein the continuous character strings are the character strings after the first character strings are overturned;
the separation module is used for inserting separators into the continuous character strings according to the position numbers of the characters in the continuous character strings to obtain second character strings;
wherein, the separation module includes following submodule:
a third detection sub-module, configured to detect whether a first character exists in the continuous character string, where the first character is a character with a position number that is a multiple of 4;
The second inserting sub-module is used for inserting a separator between the first character and a third character if the first character exists in the continuous character string, wherein the third character is a character adjacent to the first character in the continuous character string and the position number is behind the position number of the first character;
And the turnover sub-module is used for overturning the continuous character strings after the separators are inserted, so as to obtain a second character string.
8. A computer terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 6 when executing the computer program.
9. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the method according to any one of claims 1 to 6.
CN202110975652.7A 2021-08-24 2021-08-24 Digital formatting method, device, terminal equipment and storage medium Active CN113779932B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110975652.7A CN113779932B (en) 2021-08-24 2021-08-24 Digital formatting method, device, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110975652.7A CN113779932B (en) 2021-08-24 2021-08-24 Digital formatting method, device, terminal equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113779932A CN113779932A (en) 2021-12-10
CN113779932B true CN113779932B (en) 2024-07-19

Family

ID=78839160

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110975652.7A Active CN113779932B (en) 2021-08-24 2021-08-24 Digital formatting method, device, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113779932B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115908678B (en) * 2023-02-25 2023-05-30 深圳市益玩网络科技有限公司 Bone model rendering method and device, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101861341B1 (en) * 2017-05-30 2018-05-28 올댓소프트 코. Deobfuscation apparatus of application code and method of deobfuscating application code using the same
CN112948224A (en) * 2019-12-23 2021-06-11 深圳市明源云科技有限公司 Data processing method, device, terminal and storage medium

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106557452B (en) * 2015-09-25 2020-08-11 阿里巴巴集团控股有限公司 Display method, device, equipment and system for numerical characters or character strings
US10416868B2 (en) * 2016-02-29 2019-09-17 Myscript Method and system for character insertion in a character string
CN107391461B (en) * 2017-07-14 2020-07-31 中央民族大学 Tibetan language code encoding method and device and Tibetan language code decoding method and device
CN108319589B (en) * 2018-03-14 2021-08-10 腾讯科技(深圳)有限公司 Parameter string processing method, device, computer readable storage medium and equipment
CN109408113A (en) * 2018-09-03 2019-03-01 平安普惠企业管理有限公司 A kind of code text processing method, system and terminal device
CN109508352B (en) * 2018-11-16 2019-12-27 苏州好玩友网络科技有限公司 Report data output method, device, equipment and storage medium
KR102204290B1 (en) * 2019-08-23 2021-01-18 고려대학교 세종산학협력단 Identification of delimiter and static field in protocol reverse engineering using statistic analysis
CN112446987B (en) * 2019-08-27 2022-06-21 深圳市云海物联科技有限公司 Door lock password management system, gateway equipment and door lock
CN110825925B (en) * 2019-11-04 2023-05-26 沈华伟 Method for fast matching multiple character strings
CN111414728B (en) * 2020-03-05 2023-07-07 金蝶蝶金云计算有限公司 Numerical data display method, device, computer equipment and storage medium
CN112307719B (en) * 2020-10-13 2024-09-24 江汉大学 N-ary tree-based character string expression calculation method
CN112783971B (en) * 2020-12-30 2023-03-24 杭州趣链科技有限公司 Transaction recording method, transaction query method, electronic device and storage medium
CN112817602B (en) * 2021-02-26 2024-04-23 青岛海信网络科技股份有限公司 JSON format data transmitting and receiving method, device and medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101861341B1 (en) * 2017-05-30 2018-05-28 올댓소프트 코. Deobfuscation apparatus of application code and method of deobfuscating application code using the same
CN112948224A (en) * 2019-12-23 2021-06-11 深圳市明源云科技有限公司 Data processing method, device, terminal and storage medium

Also Published As

Publication number Publication date
CN113779932A (en) 2021-12-10

Similar Documents

Publication Publication Date Title
US20080222148A1 (en) Lexicographical ordering of real numbers
CN107807982B (en) Consistency checking method and device for heterogeneous database
CN111159329B (en) Sensitive word detection method, device, terminal equipment and computer readable storage medium
CN108334609B (en) Method, device, equipment and storage medium for realizing JSON format data access in Oracle
CN109885614B (en) Data synchronization method and device
CN113010116B (en) Data processing method, device, terminal equipment and readable storage medium
CN113779932B (en) Digital formatting method, device, terminal equipment and storage medium
CN112395251A (en) Intelligent analysis method and device for data file, electronic equipment and storage medium
CN117216239A (en) Text deduplication method, text deduplication device, computer equipment and storage medium
CN112949290B (en) Text error correction method and device and communication equipment
CN113688629A (en) Text deduplication method and device and storage medium
CN116303820A (en) Label generation method, label generation device, computer equipment and medium
US8078658B2 (en) ASCII to binary decimal integer conversion in a vector processor
CN114880523A (en) Character string processing method and device, electronic equipment and storage medium
CN112214494B (en) Retrieval method and device
CN115294586A (en) Invoice identification method and device, storage medium and electronic equipment
CN114462381A (en) Data processing method, device, equipment and storage medium
CN112926314A (en) Document repeatability identification method and device, electronic equipment and storage medium
CN111859901A (en) English repeated text detection method, system, terminal and storage medium
CN112990466A (en) Redundancy rule detection method and device and server
CN110287147A (en) A kind of character string sorting method and device
CN111967240B (en) Text parsing method, text parsing device, terminal equipment and computer readable storage medium
CN112287936B (en) Optical character recognition test method and device, readable storage medium and terminal equipment
CN113705150B (en) Method and equipment for generating coverage group
CN112306961B (en) Log processing method, device, equipment and storage medium

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