CN113779932A - 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
CN113779932A
CN113779932A CN202110975652.7A CN202110975652A CN113779932A CN 113779932 A CN113779932 A CN 113779932A CN 202110975652 A CN202110975652 A CN 202110975652A CN 113779932 A CN113779932 A CN 113779932A
Authority
CN
China
Prior art keywords
character string
character
digit
characters
string
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110975652.7A
Other languages
Chinese (zh)
Inventor
李奇峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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/CN113779932A/en
Publication of CN113779932A publication Critical patent/CN113779932A/en
Pending legal-status Critical Current

Links

Images

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 device, a terminal device and a storage medium, wherein the digital formatting method comprises the following steps: when the numerical value of a number meets a preset condition, determining a first character string corresponding to the integer part of the number, wherein the preset condition is that 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; sequentially numbering the characters in the first character string from the characters corresponding to the digits of the numbers according to the sequence from the low digits to the high digits; 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 formatting the number according to the second character string. The scheme can solve the problem that long numbers cannot be automatically converted according to counting units, and further is convenient for people to read the long numbers.

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, to a digital formatting method, apparatus, terminal device, and storage medium.
Background
In daily life, people often see various types of long numbers such as numbers in the size of billions and millions in various software and web pages, and when people read the long numbers, in order to prevent reading errors, the long numbers often need to be converted manually or in the brain according to counting units, but the conversion of the counting units of the long numbers cannot be clearly carried out, so that inconvenience is brought to the life of people. Therefore, it is desirable to provide a digital formatting method to automatically convert long numbers according to a certain counting unit.
Disclosure of Invention
The embodiment of the application provides a digital formatting method, a digital formatting device, terminal equipment and a storage medium, and can solve the problem that long numbers cannot be automatically converted according to counting units.
A first aspect of an embodiment of the present application provides a digital formatting method, including:
when the numerical value of a number meets a preset condition, determining a first character string corresponding to the integer part of the number, wherein the preset condition is that 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;
sequentially numbering the characters in the first character string from the characters corresponding to the digits of the numbers according to the sequence from the low digits to the high digits;
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 formatting the number according to the second character string.
A second aspect of an embodiment of the present application provides a digital formatting apparatus, including:
the character string determining module is used for determining a first character string corresponding to the 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 greater than or equal to ten thousand, or the numerical value of the number is less than or equal to minus ten thousand;
a number obtaining module, configured to sequentially number, starting from a character corresponding to the digit of the number, positions of the characters in the first character string according to an order from a low digit to a high digit;
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 number 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 of the first aspect when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program, when executed by a processor, implements the digital formatting method according to the first aspect.
A fifth aspect of embodiments of the present application provides a computer program product, which, when run on a terminal device, causes the terminal device to execute the digital formatting method according to the first aspect.
Compared with the prior art, the embodiment of the application has the advantages that: when the numerical value of a number is greater than or equal to ten thousand or less than or equal to minus ten thousand, the number can be considered to belong to a long number, and in order to avoid misreading the number, the number needs to be formatted.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic flowchart of a digital formatting method according to an embodiment of the present application;
fig. 2 is a schematic flowchart 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 apparatus 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 particular system structures, 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 will 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 this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this 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 present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated 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 numbers of the steps in this embodiment do not mean the execution sequence, and the execution sequence of each process should be determined by the function and the inherent logic of the process, and should not constitute any limitation to the implementation process of the embodiment of the present application.
Various numbers can be seen in various software, web pages and print documents frequently, when long numbers are encountered, people can not directly carry out unit conversion on the long numbers, and in Chinese culture, when long numbers are encountered, tens of thousands or hundreds of millions of counting units can be adopted, the long numbers can not be converted according to certain counting units, and 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 servers or personal computers, and can automatically convert long numbers in various software, web pages and print documents according to a certain counting unit, so as to solve the problem that people are difficult to read the long numbers.
In order to explain the technical solution of the present application, the following description is given by way of specific examples.
Referring to fig. 1, a flow chart of a digital formatting method according to an 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 a preset condition, determining a first character corresponding to the integer part of the number.
The preset condition means that the numerical value of a number is greater than or equal to ten thousand, or the numerical value of a number is less than or equal to minus ten thousand, and since the counting unit of a number includes one, ten, one hundred, one thousand, ten thousand, one hundred thousand, one million, ten million and the like, and the basic counting unit is one, ten, one hundred, one thousand and ten thousand, when the digit number of a number is greater than 5, that is, the numerical value of a number is greater than or equal to ten thousand, or the numerical value of a number is less than or equal to minus ten thousand, the number can be regarded as a long number, and conversion needs to be performed according to the counting unit.
In the embodiment of the present application, the number may be a number having only an integer part, such as 123456, or a number having a combination of an integer part and a fractional part, such as 123456.789. When the number only has an integer part, only the integer part needs to be converted; when the number is the combination of the integer part and the fractional part, the smallest counting unit is one, so when the number is converted according to a certain counting unit, the fractional 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, the number is firstly converted into the corresponding character string, the character string corresponding to the number is stored into one variable, the first character string corresponding to the integer part of the number is determined, and the first character string is processed.
In one possible implementation, when the numerical value of the number satisfies a preset condition, determining a 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 characters positioned before the identifier in 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 this embodiment, when the number of a digit is greater than or equal to ten thousand, or the number of a digit is less than or equal to minus ten thousand, the digit is converted into a third character string, the third character string is stored in a variable, whether an identifier (e.g., a decimal point) separating an integer part and a decimal part is included in the third character string is detected, if the decimal point exists in the third character string, a character string before the decimal point is obtained as a first character string corresponding to the integer part of the digit, and if the decimal point does not exist in the third character string, the non-decimal part of the digit is described, and the third character string into which the digit is converted can be directly determined as the first character string corresponding to the integer part of the digit.
Illustratively, when the number is 123456, the converted character string is "123456", and there is no decimal point in the character string, the first character 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 a decimal point exists in the character string, and 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.
And 102, sequentially numbering the characters in the first character string from the characters corresponding to the digits of the numbers according to the sequence from the low digits to the high digits.
In the embodiment of the present application, the first character string is a character string corresponding to a numeric integer part, and if the number is converted in units of "ten thousand" in the count unit, it is necessary to convert the number in units of "ten thousand" in 4-bit groups from one bit. Since the number is converted in units of counts and is closely related to the position of each character in the first character string, it is necessary to number the position of each character in the first character string.
Specifically, a character corresponding to each digit of the number is obtained, and then, the characters corresponding to the digits of the number are sequentially subjected to position numbering on the characters corresponding to the digits from the low digit to the high digit according to the sequence from the low digit to the high digit in the digit sequence table.
Illustratively, for a numeral 1234567, the character string corresponding to the numeral is "1234567", the characters corresponding to the digits are "7", the character string is arranged in the order from the lower digit to the upper digit to be "7654321", and the position numbering of each character in the character string is sequentially performed according to the arrangement order, so that the position numbering corresponding to "7" is (i), "6" is (ii), "5" is (iii), "4" is (iv), "3" is (v), "2" is (c), "1" is (c).
In one possible embodiment, sequentially numbering the characters in the first character string in order from the lower digit to the upper digit starting from the character corresponding to the digit of the number includes:
sequentially extracting characters corresponding to each digit of the digits from a first character string from the characters corresponding to the digits of the digits in sequence from the lower digits to the higher digits;
and numbering the position of the character corresponding to each extracted digit according to the extraction sequence.
In the embodiment of the present application, the characters corresponding to each digit extracted in sequence are stored in one variable (for example, in a variable buffer, the variable is different from the variable stored after the number is converted into a third character string), and the position number of the character corresponding to each digit extracted in sequence is obtained, so as to obtain the position number of the character corresponding to each digit of the number, for example, for a number 1234567, a character string "1234567" corresponding to the number is stored in one variable, and the position numbers corresponding to the extraction sequences are respectively (c), (d), and (c).
And 103, 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.
In this embodiment of the application, the second character string is obtained by inserting a separator into the first character string, and specifically, each character in the first character string may be spaced according to a 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 sequence, when the extracted characters are stored in the variable buffer, in order to ensure that the character sequence of the first character string does not change, the extracted characters are sequentially inserted into the variable buffer according to the reverse order of the extraction sequence, so that the first character string is stored in the variable buffer, and then separators are inserted into the first character string to obtain the second character string.
It should be understood that the choice of separator cannot be ambiguous, for example: the separator is a printable character and is easy to recognize, and the position of the separator may be above the number or at a subscript position.
In one possible implementation, 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, includes:
detecting whether a first character exists in a first character string, wherein the first character refers to a character with a position number being a multiple of 4;
and if the first character exists in the first character string, inserting a separator between the first character and a second character to obtain a second character string, wherein the second character is a character which is adjacent to the first character in the first character string and has a position number after the position number of the first character.
In the embodiment of the present application, when the number is converted in units of "ten thousand" counting units, each character in the character string corresponding to the number may be divided into 4 groups. When the number is to be converted in units of "thousand" count units, the characters in the character string corresponding to the number may be separated in groups of 3, that is, when the number is to be converted in units of any count unit, the character string corresponding to the number may be separated in groups of the number of characters corresponding to the count unit.
Illustratively, when the number 1234567 is converted in units of "ten thousand", the position number corresponding to the number 1234567 is acquired, and the character having the position number which is a multiple of 4 is detected, and according to the position number corresponding to the number 1234567, the character having the position number which is a multiple of 4, which is the character "4" (i.e., the first character) having the position number which is the number of r, the character "3" having the position number which is adjacent to the character "4" and is subsequent to the character "4" (i.e., the character "3" having the number of fifth), and the second character string "123' 4567" can be obtained after the character "4" and the character "3" are inserted with separators.
It should be understood that the number of the first characters in the embodiment of the present application is an integer greater than zero, that is, the characters satisfying the multiple of the position number 4 are all the first characters.
And 104, formatting the numbers according to the second character string.
In this embodiment, if there is no identifier in the digitally converted third string, the second string in the variable buffer is the result after the digits are formatted, for example, the second string in the variable buffer is "123 '4567", and then the result after the corresponding digits are formatted is 123' 4567.
If the identifier exists in the third character string after the number conversion, namely the number exists in a decimal part, acquiring a character string (namely a fourth character string) and the identifier corresponding to the decimal part from variables for storing the third character string, adding the fourth character string and the identifier to the variables for storing the second character string, and formatting the fourth character string, the identifier and the second character string according to a number combination rule. The number combination rule is 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 where the number is 1234567.89, the number 1234567.89 is converted into a character string of "1234567.89", the obtained second character string is "123 ' 4567", the identifier is ".", the fourth character string is "89", the second character string "123 ' 4567" is stored in the variable buffer, and the fourth character string and the identifier are added to the variable buffer, so that the result after formatting can be "123 ' 4567.89". According to the formatted result, people can clearly and directly obtain that the number is one hundred twenty-three million, four thousand, five hundred sixty-seven and eight nine, and the problem that people read long numbers difficultly is solved.
In a possible implementation manner, a memory buffer may be preset, a character string corresponding to the integer portion is stored in the preset memory buffer, when a first character exists in the character string corresponding to the integer portion, a separator is added to a corresponding position of the preset memory buffer, when all separators are added to corresponding positions of the preset memory buffer, a second character string is obtained, if a decimal portion exists in the number, the character string and the identifier corresponding to the decimal portion are added to the preset memory buffer, and the second character string, the character string and the identifier corresponding to the decimal portion are formatted in the preset memory buffer according to a number combination rule. If the number does not have a decimal part, the second character string in the preset memory buffer area is the result after formatting.
In the embodiment of the present application, when the number of a digit is equal to or greater than ten thousand or equal to or less than minus ten thousand, the digit may be considered to belong to a long digit, and in order to avoid misreading the digit, the formatting process of the digit is required to include, first, determining a first character string corresponding to an integer part of the digit, then, sequentially position-numbering characters in the first character string in order from a lower digit to a higher digit from characters corresponding to the digit of the digit, inserting a separator in the first character string according to the position number of each character to obtain a second character string, the separator may separate the digit by a count unit, and finally, formatting the digit according to the second character string, so that the long digit may be automatically converted by the count unit.
Referring to fig. 2, a flow chart of a digital formatting method provided in the second embodiment of the present application is shown, and the digital formatting method shown in fig. 2 may include the following steps:
step 201, when the numerical value of the number meets a preset condition, determining a first character corresponding to the integer part of the number.
In step 202, the characters corresponding to the digits of the numbers are sequentially numbered from the lower digit to the higher digit.
The steps 201-202 of this embodiment are the same as the steps 101-102 of the previous embodiment, and reference may be made to these steps, which are not described herein again.
And step 203, recombining the characters after position numbering 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 characters corresponding to each digit of the digits are sequentially extracted from the first character string according to the order from the lower digits to the upper digits, the extracted characters can be directly stored in the variable buffer according to the extraction order, and at this time, a continuous character string composed of the characters stored in the variable buffer according to the extraction order is a character string in which the first character string is inverted.
Illustratively, if the number is 1234567, the corresponding first character string is "1234567", the characters extracted in the order from the lower digit to the upper digit are "7", "6", "5", "4", "3", "2", and "1", the characters are stored in the variable buffer in the order of extraction, that is, the characters are rearranged in the order from the lower digit to the upper digit, and at this time, the continuous character string stored in the variable buffer is "7654321", that is, the continuous character string is the character string in which the first character string is inverted.
It should be understood that, in the embodiment of the present application, while the characters in the first character string are position-numbered according to the extraction order, the characters in the first character string may be directly stored in the variable buffer according to the extraction order, so that the characters are recombined to obtain an inverted first character string (i.e., a continuous character string), and after the position numbering is performed, the characters may be recombined according to the order from the lower digit to the higher digit of the position numbering to obtain a continuous character string.
And step 204, 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 this embodiment of the application, the second character string is obtained by inserting separators into the consecutive character string, and specifically, each character in the consecutive character string may be spaced according to the position number of each character in the consecutive character string.
In one possible implementation, inserting separators into the consecutive character strings according to the position numbers of the characters in the consecutive character strings to obtain second character strings includes:
detecting whether a first character exists in the continuous character string, wherein the first character refers to a character with a position number being a multiple of 4;
if the first character exists in the continuous character string, a separator is inserted between the first character and a third character, wherein the third character refers to a character which is adjacent to the first character in the continuous character string and has a position number after the position number of the first character;
and turning over the continuous character string after the separator is inserted to obtain a second character string.
In the embodiment of the present application, the position number of each character in the continuous string corresponds to the position number of each character in the first string, for example, the determined first string is "1234567", the reconstructed continuous string is "7654321", the position number corresponding to "7" in the first string is (r), and therefore the position number corresponding to "7" in the continuous string is also (r).
Specifically, whether a first character exists in the continuous character string is detected, if the first character exists, a separator is inserted between the first character and a third character, after all separators are inserted, the continuous character string after the separators are inserted is turned over to obtain a second character string, and the second character string is the same as the first character string after the separators are inserted.
Illustratively, the first character string of numbers is "1234567", the recombined continuous character string is "7654321", the position number corresponding to each character in the continuous character string is ((r)), ((c) ()) according to the position number corresponding to each character in the continuous character string, the character with the position number of multiple of 4 is the character with the position number of (r) ((4) (i.e. the first character)), the third character is the character adjacent to the character (4) and with the position number after (r) ((r) (), (3) ((c) () according to the position number corresponding to each character in the continuous character string, the continuous character string after inserting the delimiter can be obtained as "7654' 321" after inserting the delimiter, since the continuous character string can be regarded as the character string after the first character string is inverted, the continuous character string after inserting the delimiter needs to be inverted to obtain the second character string, the second character string obtained at this time is "123' 4567".
Step 205, formatting the number according to the second character string.
Step 205 of this embodiment is the same as step 104 of the previous embodiment, and reference may be made to this embodiment, which is not described herein again.
Compared with the first embodiment, in the embodiment of the present application, the extracted characters are directly stored in the variable buffer or the preset memory buffer according to the extraction sequence (i.e., the position numbers), and when a character is inserted into a character string without a fixed insertion rule (e.g., inserting the character into a corresponding position in the character string), the extracted characters are usually directly inserted into the end of the character string, so that the characters are stored in the variable buffer or the preset memory buffer according to the extraction sequence, and the character strings are recombined to obtain a continuous character string, and then the continuous character string is subjected to an operation of inserting a separator, and after the separator is inserted, the continuous character string is turned over to obtain a second character string, which is strict in formatting process and less prone to errors, and can better convert long characters according to a count unit.
Referring to fig. 3, a schematic structural diagram of a digital formatting apparatus provided in the third embodiment of the present application is shown, and for convenience of description, only the portions related to the third embodiment of the present application are shown.
The digital formatting device may specifically include the following modules:
a character string determining module 301, configured to determine a first character string corresponding to an integer part of a number when the numeric value of the number meets a preset condition, where the preset condition is that the numeric value of the number is greater than or equal to ten thousand, or the numeric value of the number is less than or equal to minus ten thousand;
a number obtaining module 302, configured to sequentially number, starting from a character corresponding to a digit of a number, positions of characters in a first character string according to an order from a low digit to a high digit;
an inserting module 303, configured to insert a separator in the first character string according to the position number of each character in the first character string to obtain a second character string;
and a formatting module 304, configured to format the number according to the second character string.
In this embodiment, the character string determining 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;
a first determination submodule configured to, if an identifier exists in the third string, form a first string based on a character located before the identifier in the third 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 this embodiment of the application, for the case that the identifier exists in the third string, the formatting module 304 may specifically include the following sub-modules:
the character string constructing submodule is used for constructing a fourth character string based on characters positioned after the identifier in the third character string, and the fourth character string is a character string corresponding to the decimal part;
and the combining submodule is used for formatting the fourth character string, the identifier and the second character string according to a number combining rule.
In this embodiment, the digital formatting apparatus 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 to a preset memory buffer area under the condition that the identifier does not exist in the third character string.
In this 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 characters corresponding to each digit of the digits from the first character string from the characters corresponding to the digits of the digits according to the sequence from the low digits to the high digits;
and the numbering submodule is used for carrying out position numbering on the characters corresponding to each digit extracted in sequence according to the extraction sequence.
In this embodiment, the insertion 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, and the first character refers to a character with a position number of multiple of 4;
and the first inserting sub-module is used for inserting a separator between the first character and a second character to obtain a second character string if the first character exists in the first character string, wherein the second character refers to a character which is adjacent to the first character in the first character string and has a position number after the position number of the first character.
In this embodiment, the digital formatting apparatus may further include the following modules:
the recombination module is used for recombining each character after position numbering according to the sequence from a low digit to a high digit to obtain a continuous character string;
and the separating module is used for inserting separating characters 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 partitioning module may specifically include the following sub-modules:
the third detection submodule is used for detecting whether a first character exists in the continuous character string, wherein the first character refers to a character with a position number of multiple of 4;
the second inserting sub-module is used for inserting a separator between a first character and a third character if the first character exists in the continuous character string, wherein the third character is a character which is adjacent to the first character in the continuous character string and has a position number after the position number of the first character;
and the turning submodule is used for turning the continuous character string after the separator is inserted into the continuous character string to obtain a second character string.
The digital formatting device provided in the embodiment of the present application can be applied to the foregoing method embodiments, and for details, reference is made to the description of the foregoing method embodiments, which is not described herein again.
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 of the above embodiments of the digital formatting method when executing the computer program 421.
The terminal device 400 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device may include, but is not limited to, a processor 410, a memory 420. Those skilled in the art will appreciate that fig. 4 is merely an example of the terminal device 400, and does not constitute a limitation of the terminal device 400, and may include more or less components than those shown, or combine some of the components, or different components, such as an input-output device, a network access device, etc.
The Processor 410 may be a Central Processing Unit (CPU), and the Processor 410 may be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, 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 Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and 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 for storing an operating system, an application program, a Boot Loader (Boot Loader), data, and other programs, such as program codes of the computer programs. 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-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
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 implementation. 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 ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed 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 can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
When the computer program product runs on a terminal device, the steps in the method embodiments can be implemented when the terminal device executes the computer program product.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same. Although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (11)

1. A digital formatting method, comprising:
when the numerical value of a number meets a preset condition, determining a first character string corresponding to the integer part of the number, wherein the preset condition is that 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;
sequentially numbering the characters in the first character string from the characters corresponding to the digits of the numbers according to the sequence from the low digits to the high digits;
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 formatting the number according to the second character string.
2. The digital formatting method of claim 1, wherein determining the first string corresponding to the integer part of the number when the numerical value of the number satisfies a preset condition comprises:
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 which are positioned in the third character string and are positioned before the identifier;
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 number formatting method of claim 2, wherein said formatting the number according to the second string, in the presence of the identifier in the third string, comprises:
forming a fourth character string based on characters positioned after the identifier in the third character string, wherein the fourth character string is a character string corresponding to a decimal part;
formatting the fourth string, the identifier, and the second string according to a digit combination rule.
4. The digital formatting method of claim 3, further comprising:
under the condition that the identifier exists in the third character string, storing the fourth character string, the identifier and the second character string in a preset memory buffer area;
and under the condition that the identifier does not exist in the third character string, storing the second character string in the preset memory buffer area.
5. The digital formatting method according to claim 1, wherein said sequentially numbering characters in said first character string in order from a lower digit to an upper digit starting from a character corresponding to a digit of said digit, comprises:
sequentially extracting characters corresponding to each digit of the number from the first character string in the order from the lower digit to the upper digit from the characters corresponding to the digits of the number;
and carrying out position numbering on the characters corresponding to each digit extracted in sequence according to the extraction sequence.
6. The digital formatting method as claimed in claim 1, wherein said inserting a separator into said first character string according to the position number of each character in said first character string to obtain a second character string comprises:
detecting whether a first character exists in the first character string, wherein the first character is a character with a position number being a multiple of 4;
and if the first character exists in the first character string, inserting a separator between the first character and a second character to obtain a second character string, wherein the second character refers to a character which is adjacent to the first character in the first character string and has a position number after the position number of the first character.
7. The digital formatting method as claimed in claim 1, wherein before inserting a separator into said first character string according to the position number of each character in said first character string to obtain a second character string, further comprising:
recombining each character after position numbering according to the sequence from a low digit to a high digit to obtain a continuous character string;
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 includes:
and inserting separators into the continuous character string according to the position numbers of the characters in the continuous character string to obtain a second character string.
8. The digital formatting method according to claim 7, wherein said inserting a separator into a consecutive character string according to a position number of each character in said consecutive character string to obtain a second character string comprises:
detecting whether a first character exists in the continuous character string, wherein the first character is a character with a 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 refers to a character which is adjacent to the first character in the continuous character string and has a position number after the position number of the first character;
and turning over the continuous character string after the separator is inserted to obtain the second character string.
9. A digital formatting apparatus, comprising:
the character string determining module is used for determining a first character string corresponding to the 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 greater than or equal to ten thousand, or the numerical value of the number is less than or equal to minus ten thousand;
a number obtaining module, configured to sequentially number, starting from a character corresponding to the digit of the number, positions of the characters in the first character string according to an order from a low digit to a high digit;
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.
10. A 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 8 when executing the computer program.
11. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 8.
CN202110975652.7A 2021-08-24 2021-08-24 Digital formatting method, device, terminal equipment and storage medium Pending CN113779932A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110975652.7A CN113779932A (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 CN113779932A (en) 2021-08-24 2021-08-24 Digital formatting method, device, terminal equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113779932A true CN113779932A (en) 2021-12-10

Family

ID=78839160

Family Applications (1)

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

Country Status (1)

Country Link
CN (1) CN113779932A (en)

Cited By (1)

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

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106557452A (en) * 2015-09-25 2017-04-05 阿里巴巴集团控股有限公司 For the display packing of numeric character or character string, device, equipment and system
CN107391461A (en) * 2017-07-14 2017-11-24 中央民族大学 Method and apparatus, the method and apparatus of Tibetan language code decoding of Tibetan language code coding
KR101861341B1 (en) * 2017-05-30 2018-05-28 올댓소프트 코. Deobfuscation apparatus of application code and method of deobfuscating application code using the same
CN108319589A (en) * 2018-03-14 2018-07-24 腾讯科技(深圳)有限公司 Parameter string processing method, apparatus, computer readable storage medium and equipment
CN109074223A (en) * 2016-02-29 2018-12-21 麦斯杰公司 For carrying out the method and system of character insertion in character string
CN109408113A (en) * 2018-09-03 2019-03-01 平安普惠企业管理有限公司 A kind of code text processing method, system and terminal device
CN109508352A (en) * 2018-11-16 2019-03-22 苏州好玩友网络科技有限公司 A kind of output method of report data, device, equipment and storage medium
CN110825925A (en) * 2019-11-04 2020-02-21 沈华伟 Method for rapidly matching multiple character strings
KR102204290B1 (en) * 2019-08-23 2021-01-18 고려대학교 세종산학협력단 Identification of delimiter and static field in protocol reverse engineering using statistic analysis
CN112307719A (en) * 2020-10-13 2021-02-02 江汉大学 Character string expression calculation method based on N-way tree
CN112446987A (en) * 2019-08-27 2021-03-05 深圳市云海物联科技有限公司 Door lock password management system, gateway equipment and door lock
CN112817602A (en) * 2021-02-26 2021-05-18 青岛海信网络科技股份有限公司 JSON format data sending and receiving method, device and medium
CN112948224A (en) * 2019-12-23 2021-06-11 深圳市明源云科技有限公司 Data processing method, device, terminal and storage medium

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106557452A (en) * 2015-09-25 2017-04-05 阿里巴巴集团控股有限公司 For the display packing of numeric character or character string, device, equipment and system
CN109074223A (en) * 2016-02-29 2018-12-21 麦斯杰公司 For carrying out the method and system of character insertion in character string
KR101861341B1 (en) * 2017-05-30 2018-05-28 올댓소프트 코. Deobfuscation apparatus of application code and method of deobfuscating application code using the same
CN107391461A (en) * 2017-07-14 2017-11-24 中央民族大学 Method and apparatus, the method and apparatus of Tibetan language code decoding of Tibetan language code coding
CN108319589A (en) * 2018-03-14 2018-07-24 腾讯科技(深圳)有限公司 Parameter string processing method, apparatus, 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
CN109508352A (en) * 2018-11-16 2019-03-22 苏州好玩友网络科技有限公司 A kind of output method of report data, 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
CN112446987A (en) * 2019-08-27 2021-03-05 深圳市云海物联科技有限公司 Door lock password management system, gateway equipment and door lock
CN110825925A (en) * 2019-11-04 2020-02-21 沈华伟 Method for rapidly matching multiple character strings
CN112948224A (en) * 2019-12-23 2021-06-11 深圳市明源云科技有限公司 Data processing method, device, terminal and storage medium
CN112307719A (en) * 2020-10-13 2021-02-02 江汉大学 Character string expression calculation method based on N-way tree
CN112817602A (en) * 2021-02-26 2021-05-18 青岛海信网络科技股份有限公司 JSON format data sending and receiving method, device and medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
沈亮等: "面向移动应用识别的结构化特征提取方法", 计算机应用, vol. 40, no. 4, 25 November 2019 (2019-11-25), pages 1109 *
谭欣等: "GS1数据矩阵码浅析", 条码与信息系统, no. 4, 28 July 2021 (2021-07-28), pages 21 *
陈英;: "数值计算可视化系统中输入函数的计算", 信息技术, vol. 31, no. 11, 25 November 2007 (2007-11-25), pages 90 *

Cited By (2)

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

Similar Documents

Publication Publication Date Title
CN108388598B (en) Electronic device, data storage method, and storage medium
US20080222148A1 (en) Lexicographical ordering of real numbers
US20120218130A1 (en) Indexing compressed data
CN111159329B (en) Sensitive word detection method, device, terminal equipment and computer readable storage medium
CN111539502B (en) Anti-counterfeiting two-dimensional code generation method and device, server and storage medium
CN108334609B (en) Method, device, equipment and storage medium for realizing JSON format data access in Oracle
CN111797594B (en) Character string processing method based on artificial intelligence and related equipment
CN113111227A (en) Data processing method and device, electronic equipment and storage medium
CN113010116A (en) Data processing method and device, terminal equipment and readable storage medium
CN113779932A (en) Digital formatting method, device, terminal equipment and storage medium
CN113688629A (en) Text deduplication method and device and storage medium
CN111898340A (en) File processing method and device and readable storage medium
CN107943760B (en) Method and device for optimizing fonts of PDF document editing, terminal equipment and storage medium
CN115294586A (en) Invoice identification method and device, storage medium and electronic equipment
CN112783971B (en) Transaction recording method, transaction query method, electronic device and storage medium
CN111783787B (en) Method and device for recognizing image characters and electronic equipment
CN111090743B (en) Thesis recommendation method and device based on word embedding and multi-value form concept analysis
CN110874398B (en) Forbidden word processing method and device, electronic equipment and storage medium
CN112307070A (en) Mask data query method, device and equipment
CN109344132B (en) User information merging method, computer readable storage medium and terminal device
CN117194355B (en) Data processing method and device based on database and electronic equipment
CN111967240B (en) Text parsing method, text parsing device, terminal equipment and computer readable storage medium
CN114880523A (en) Character string processing method and device, electronic equipment and storage medium
CN111046012B (en) Method and device for extracting inspection log, storage medium and electronic equipment
CN117909397A (en) Method and device for transferring text data of node model

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