Full-Text Replacement Method, Apparatus, Text Editor, and Computing Device
By replacing the keyword characters in large text files one after another and combining control interface adjustment, the lag caused by memory usage in the prior art is solved, and the replacement efficiency and user experience are improved.
Patent Information
- Application Number
- CN202111231476.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-22
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2041-10-22
AI Technical Summary
Existing full-text replacement methods are prone to occupying too much memory in large text files, resulting in stuttering of the text interface and affecting the user experience.
The sequential replacement method is adopted to determine the initial replacement speed based on the number of keywords in the text content, and adjust the replacement speed through the control interface, pause or terminate the replacement process to avoid memory consumption.
It effectively avoids the lag problem caused by memory usage in large text files, and improves replacement efficiency and user experience.
Smart Images

Figure CN114021525B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and particularly to a full-text replacement method, a full-text replacement device, a text editor, and a computing device. Background Art
[0002] Currently, common text editing software usually provides a full-text replacement function. Based on the full-text replacement operation, a certain key character a in the text content can be replaced with another key character b. According to the existing full-text replacement solution, all the text content to be replaced in the initial state is first obtained and saved. After all the key characters a are replaced with b at one time, if it is necessary to restore the replaced text content, all the replaced key characters b in the text content need to be restored to a at one time.
[0003] For large text files with a large amount of text content, using the existing method, during the process of full-text replacement and restoration operations, due to a large amount of replaced content, it will occupy too much memory, and it is easy to cause the phenomenon of text interface jamming during the execution of full-text replacement and restoration.
[0004] Therefore, a full-text replacement method is needed to solve the problems existing in the above technical solutions. Summary of the Invention
[0005] Therefore, the present invention provides a full-text replacement method, a full-text replacement device, and a text editor, in an attempt to solve or at least alleviate the problems existing above.
[0006] According to one aspect of the present invention, a full-text replacement method is provided, which is executed in a text editor and includes the steps of: receiving a full-text replacement request for a key character in a text file; traversing the text content in the text file to find one or more key characters included in the text content; determining an initial replacement speed according to the number of key characters included in the text content; and based on the initial replacement speed, sequentially replacing each key character in the text content with a target character until the full-text replacement is completed.
[0007] Optionally, in the full-text replacement method according to the present invention, the method further includes the step of: displaying a control interface for the user to control the full-text replacement process based on the control interface.
[0008] Optionally, in the full-text replacement method according to the present invention, the method further includes the steps of: receiving an adjustment instruction for the replacement speed sent on the control interface, determining a new adjusted replacement speed according to the adjustment instruction; and according to the new replacement speed, sequentially replacing each remaining key character with a target character.
[0009] Optionally, in the full-text replacement method according to the present invention, the method further includes the step of receiving a pause replacement instruction sent on the control interface and pausing the replacement of the remaining key characters.
[0010] Optionally, in the full-text replacement method according to the present invention, the method further includes the step of receiving a termination replacement instruction sent on the control interface, terminating the replacement of the remaining key characters, and restoring the replaced key characters.
[0011] Optionally, in the full-text replacement method according to the present invention, the method further includes the steps of determining the replacement time required to complete the full-text replacement according to the initial replacement speed and the number of key characters, and displaying the replacement time on the control interface; during the process of sequentially replacing each key character in the text content with the target character, the method further includes the steps of determining the remaining number of key characters, determining the remaining replacement time required to complete the full-text replacement according to the current replacement speed and the remaining number, and displaying the remaining replacement time on the control interface to update the replacement time.
[0012] Optionally, in the full-text replacement method according to the present invention, the step of finding one or more key characters included in the text content includes: determining the replacement position corresponding to each key character; sequentially replacing each key character in the text content with the target character includes: traversing the replacement positions corresponding to each key character, and sequentially replacing each key character in the text content with the target character based on each replacement position.
[0013] Optionally, in the full-text replacement method according to the present invention, the step of determining the initial replacement speed according to the number of key characters included in the text content includes: when n ≤ 10 6 , f(n) = 10 characters / second; when n > 10 6 , f(n) = 10 * (n / 10 6 ) characters / second; where n represents the number of key characters, and f(n) represents the initial replacement speed.
[0014] Optionally, in the full-text replacement method according to the present invention, the method further includes the steps of checking whether each key character in the text content has been replaced with the target character. If so, a message indicating that the replacement is completed is displayed, and the text content after the replacement is displayed. If not, it is determined that the replacement fails, a message indicating that the replacement fails is displayed, and the number of replaced key characters is displayed.
[0015] Optionally, in the full text replacement method according to the present invention, after completing the full text replacement, the method further includes the steps of: receiving a full text restoration request for a target character in a text file; traversing the text content in the text file to find one or more target characters included in the text content; and based on the initial replacement speed, sequentially restoring each target character in the text content to the key character until the full text restoration is completed.
[0016] According to one aspect of the present invention, there is provided a full text replacement device resident in a text editor, the device including: a receiving unit adapted to receive a full text replacement request for a key character in a text file; a searching unit adapted to traverse the text content in the text file to find one or more key characters included in the text content; a determining unit adapted to determine an initial replacement speed according to the number of key characters included in the text content; and a replacement unit adapted to sequentially replace each key character in the text content with a target character based on the initial replacement speed until the full text replacement is completed.
[0017] According to one aspect of the present invention, there is provided a text editor including a full text replacement device, the full text replacement device being adapted to execute the method as described above.
[0018] According to one aspect of the present invention, there is provided a computing device including: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, and the program instructions include instructions for executing the full text replacement method as described above.
[0019] According to one aspect of the present invention, there is provided a readable storage medium storing program instructions, which when read and executed by a computing device, cause the computing device to execute the method as described above.
[0020] According to the technical solution of the present invention, a full-text replacement method is provided. When the user requests to perform a full-text replacement on a key character, each key character in the text content is successively replaced with a target character, rather than replacing all the key characters in the text content at once and uniformly with the target character. Based on this, for large text files, in the case where there are many key characters to be replaced in the text content, the successive replacement method can avoid occupying a large amount of memory resources, thereby avoiding the problem of lag during the use of the text editor. In addition, the present invention determines the initial replacement speed according to the number of key characters to be replaced in the text content, and replaces the key characters in the text content based on the determined initial replacement speed. In this way, the replacement speed is reasonably controlled according to the number of key characters to be replaced, so as to avoid taking a long time in the case of a large number of key characters to be replaced, and ensure that the replacement efficiency is improved as much as possible without lagging.
[0021] In addition, the present invention displays a control interface during the replacement process. In this way, during the full-text replacement process, the user can adjust the replacement speed and pause the replacement process based on the control interface according to the actual situation and needs, so as to meet the user's needs as much as possible and improve the user experience.
[0022] The above description is only an overview of the technical solution of the present invention. In order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable, the specific embodiments of the present invention are specifically exemplified below. Brief Description of the Drawings
[0023] To achieve the above and related purposes, certain illustrative aspects are described herein in connection with the following description and drawings, which indicate various ways in which the principles disclosed herein can be practiced, and all aspects and their equivalent aspects are intended to fall within the scope of the claimed subject matter. By reading the following detailed description in conjunction with the drawings, the above and other purposes, features and advantages of the present disclosure will become more apparent. Throughout the present disclosure, like reference numerals generally refer to like components or elements.
[0024] Figure 1 A schematic diagram of a computing device 100 according to an embodiment of the present invention is shown;
[0025] Figure 2 A flowchart of a full-text replacement method 200 according to an embodiment of the present invention is shown; and
[0026] Figure 3 A schematic diagram of a text editor 300 according to an embodiment of the present invention is shown. Detailed Description of the Embodiments
[0027] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be fully conveyed to those skilled in the art.
[0028] Figure 1 is a schematic block diagram of an exemplary computing device 100.
[0029] As Figure 1 shown, in a basic configuration 102, the computing device 100 typically includes a system memory 106 and one or more processors 104. A memory bus 108 can be used for communication between the processor 104 and the system memory 106.
[0030] Depending on the desired configuration, the processor 104 can be any type of processor, including but not limited to: a microprocessor (UP), a microcontroller (UC), a digital signal processor (DSP), or any combination thereof. The processor 104 can include one or more levels of cache such as a level 1 cache 110 and a level 2 cache 112, a processor core 114, and registers 116. Exemplary processor cores 114 can include an arithmetic logic unit (ALU), a floating point unit (FPU), a digital signal processing core (DSP core), or any combination thereof. An exemplary memory controller 118 can be used with the processor 104, or in some implementations, the memory controller 118 can be an internal part of the processor 104.
[0031] Depending on the desired configuration, the system memory 106 can be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. The system memory 106 can include an operating system 120, one or more applications 122, and program data 124. In some embodiments, the applications 122 can be arranged to execute instructions on the operating system by one or more processors 104 using the program data 124.
[0032] The computing device 100 further includes a storage device 132, and the storage device 132 includes a removable storage 136 and a non-removable storage 138.
[0033] The computing device 100 may also include a storage interface bus 134. The storage interface bus 134 enables communication from storage devices 132 (e.g., removable storage 136 and non-removable storage 138) via the bus / interface controller 130 to the basic configuration 102. At least a portion of the operating system 120, applications 122, and data 124 may be stored on the removable storage 136 and / or non-removable storage 138, and when the computing device 100 is powered on or an application 122 is to be executed, it is loaded into the system memory 106 via the storage interface bus 134 and executed by one or more processors 104.
[0034] The computing device 100 may also include an interface bus 140 that facilitates communication from various interface devices (e.g., output device 142, peripheral interface 144, and communication device 146) to the basic configuration 102 via the bus / interface controller 130. Example output devices 142 include a graphics processing unit 148 and an audio processing unit 150. They may be configured to facilitate communication with various external devices such as a display or speakers via one or more A / V ports 152. Example peripheral interfaces 144 may include a serial interface controller 154 and a parallel interface controller 156, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I / O ports 158. Example communication device 146 may include a network controller 160, which may be arranged to facilitate communication with one or more other computing devices 162 via one or more communication ports 164 through a network communication link.
[0035] The network communication link may be an example of a communication medium. A communication medium typically may embody computer-readable instructions, data structures, program modules in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium. A “modulated data signal” may be a signal in which one or more of its data concentrations or its changes can be encoded in the signal in a manner that encodes information. As a non-limiting example, the communication medium may include wired media such as a wired network or a dedicated line network, and various wireless media such as sound, radio frequency (RF), microwave, infrared (IR), or other wireless media. The term computer-readable medium as used herein may include both storage media and communication media.
[0036] The computing device 100 can be implemented as a personal computer including desktop computer and notebook computer configurations. Of course, the computing device 100 can also be implemented as part of a small-sized portable (or mobile) electronic device, which can be, for example, a cellular phone, a digital camera, a personal digital assistant (PDA), a personal media player device, a wireless network browsing device, a personal head-mounted device, an application-specific device, or a hybrid device incorporating any of the above functions. It can even be implemented as a server, such as a file server, a database server, an application server, and a WEB server, etc. Embodiments of the present invention are not limited thereto.
[0037] In an embodiment according to the present invention, the computing device 100 is configured to execute the full-text replacement method 200 according to the present invention. Among them, the application of the computing device 100 contains multiple program instructions for executing the full-text replacement method 200 of the present invention, and these program instructions can instruct the processor to execute the full-text replacement method 200 of the present invention, so that the computing device 100 can replace the key characters in the full text by executing the full-text replacement method 200 of the present invention.
[0038] According to an embodiment of the present invention, the application arranged on the operating system of the computing device 100 contains a text editor 300, and the text editor 300 contains multiple program instructions for executing the full-text replacement method 200 of the present invention, so that the full-text replacement method 200 of the present invention can be executed in the text editor 300.
[0039] According to an embodiment of the present invention, a full-text replacement device 350 resides in the text editor 300, and the full-text replacement device 350 contains multiple program instructions for executing the full-text replacement method 200 of the present invention, so that the full-text replacement method 200 of the present invention can be executed in the full-text replacement device 350 of the text editor 300.
[0040] Figure 2 A flowchart of the full-text replacement method 200 according to an embodiment of the present invention is shown. The full-text replacement method 200 can be executed in the text editor 300 of a computing device (such as the aforementioned computing device 100), specifically in the full-text replacement device 350 of the text editor 300.
[0041] It should be noted that the full-text replacement method 200 according to the present invention can be executed in various text editors, and the present invention is not limited to the specific type of text editor. When the text editor opens a text file, the full-text replacement method 200 of the present invention can be executed.
[0042] As Figure 2 shown, the full-text replacement method 200 starts from step S210.
[0043] In step S210, a full-text replacement request for the key characters in the text file currently opened by the text editor is received. That is, the user requests to replace all the key characters in the text file with the target characters.
[0044] In one implementation, the user can trigger the use of the full-text replacement function through a click operation. For example, within the window of the text editor, there is a control corresponding to the full-text replacement function. The user can call out the corresponding full-text replacement function interface by clicking on the full-text replacement function control within the text editor window or through the full-text replacement shortcut key. Subsequently, on the full-text replacement function interface, the key characters for replacing the text content in the text file are input, and the target characters are input. Based on the key characters and the target characters, a full-text replacement request for the key characters in the text file is sent to request the text editor to replace all the key characters in the text file with the target characters.
[0045] Subsequently, in step S220, all the text content in the text file is traversed to find one or more key characters included in all the text content of the text file. The one or more key characters found are the characters to be replaced. Here, by traversing the text content in the text file from beginning to end, after each key character is found, the replacement position corresponding to the key character can be determined, so as to replace the key character with the target character based on the replacement position of each key character.
[0046] Subsequently, in step S230, the initial replacement speed is determined according to the number of key characters included in the text content.
[0047] In one implementation, if the number of key characters is represented as n and the initial replacement speed is represented as f(n), then the initial replacement speed f(n) can be determined according to the following method:
[0048] When n ≤ 10 6 , f(n) = 10 characters per second;
[0049] When n > 10 6 , f(n) = 10 * (n / 10 6 ) characters per second. Here, (n / 10 6 ) takes the integer value of k.
[0050] That is to say, when the number of key characters does not exceed 10 6 , the initial replacement speed is 10 characters per second, that is, 10 characters are replaced per second. When the number of key characters is greater than 10 6 , the initial replacement speed is an integer multiple of 10 (10k). In this way, when the number of key characters is relatively large and exceeds 10 6 , for every increase of 10 6, the initial replacement speed will increase by 10 per second accordingly.
[0051] Finally, based on the initial replacement speed, each key character in the text content is successively replaced with the target character until the full text replacement is completed, that is, until all the key characters contained in the text content are replaced with the target character.
[0052] Specifically, in the process of traversing the text content to find one or more key characters, by determining the replacement position corresponding to each key character in the text content, thus, by traversing the replacement positions corresponding to each key character, each key character in the text content is successively replaced with the target character based on the replacement position of each key character.
[0053] It should be noted that in the present invention, each key character in the text content is successively replaced with the target character, rather than all the key characters in the text content being replaced with the target character at once and uniformly. Based on this, for large text files, in the case where there are many key characters to be replaced in the text content, the successive replacement method can avoid occupying too much memory resources, thereby avoiding the problem of the text editor freezing during use.
[0054] In addition, the present invention determines the initial replacement speed according to the number of key characters to be replaced contained in the text content, and replaces the key characters in the text content based on the determined initial replacement speed. In this way, the replacement speed is reasonably controlled according to the number of key characters to be replaced, thereby avoiding taking a long time in the case where there are many key characters to be replaced, and ensuring that the replacement efficiency is improved as much as possible without freezing.
[0055] According to an embodiment of the present invention, before each key character in the text content is successively replaced with the target character, and during the process of successively replacing each key character with the target character, a control interface can be displayed on the system desktop of the computing device, and the user can control the full text replacement process based on the control interface, for example, can adjust the replacement speed, pause the replacement process, etc. In addition, information such as the current replacement speed and the remaining replacement time can also be displayed on the control interface.
[0056] In one embodiment, the control interface includes an adjustment control for adjusting the replacement speed, and the user can adjust the replacement speed by operating the adjustment control on the control interface. Specifically, the user sends an adjustment instruction for the replacement speed by operating the adjustment control on the control interface, and after the text editor receives the adjustment instruction for the replacement speed sent by the user on the control interface, determines the new replacement speed after adjustment according to the adjustment instruction. Subsequently, according to the new replacement speed, each remaining key character that has not been replaced is successively replaced with the target character.
[0057] In this way, the user can adjust the replacement speed according to the requirements in the actual application process, so that the speed of replacing the full text can meet the user's needs, improving the user experience.
[0058] In one embodiment, the control interface includes a pause control for pausing the replacement process. The user sends a pause replacement instruction by clicking the pause control on the control interface. After receiving the pause replacement instruction sent by the user on the control interface, the text editor pauses the current replacement process, that is, pauses replacing the remaining critical characters that have not been replaced. Based on the successive replacement scheme of the present invention, during the full-text replacement of critical characters, when the user discovers a problem, the replacement process can be immediately stopped by clicking the pause control.
[0059] In one embodiment, the control interface includes a termination control for terminating the replacement process during replacement. The user sends a termination replacement instruction by clicking the termination control on the control interface. After receiving the termination replacement instruction sent by the user on the control interface, the replacement of the remaining critical characters is terminated midway during replacement, and the replaced critical characters are restored, that is, each target character obtained by replacement is restored to the initial critical character.
[0060] In this way, during the full-text replacement of critical characters, if the user finds that this replacement is not required, the current replacement process can be immediately terminated through the termination control, and the text content can be restored to the initial text content, without having to wait until the replacement is completed to restore the text content. In this way, according to the solution of the present invention, the control of the full-text replacement process is more convenient and efficient.
[0061] According to an embodiment of the present invention, based on the initial replacement speed and the number of critical characters, the replacement time required to complete the full-text replacement is determined, and the replacement time is displayed on the control interface.
[0062] In addition, during the process of successively replacing each critical character in the text content with a target character, the remaining number of critical characters can be determined in real time. Based on the current replacement speed and the remaining number, the remaining replacement time required to complete the full-text replacement in the current state is determined, and the remaining replacement time is updated and displayed on the control interface to update the replacement time displayed on the control interface.
[0063] According to an embodiment of the present invention, after completing the full-text replacement, it is further checked whether each key character in the text content has been replaced with the target character. If so, a message indicating that the replacement is completed can be displayed on the control interface, and the text content after the replacement can be displayed within the text view for displaying the text content on the window of the text editor, so that all key characters in the text content are replaced with the target character for display, realizing the update of the text content. If not, it is determined that the replacement fails. At this time, a message indicating that the replacement fails can be displayed on the control interface, and the number of key characters that have been replaced can be displayed, so that the user can understand the specific status of the failure of this replacement.
[0064] In an embodiment of the present invention, after completing the full-text replacement by successively replacing each key character in the text content with the target character, in response to the user's restoration request, each target character in the text content can be successively restored to the key character in the original file.
[0065] Specifically, corresponding to the above replacement process, the text editor can receive the user's full-text restoration request for the target characters in the text file. Here, within the window of the text editor, there are controls corresponding to the full-text restoration function. The user can send a full-text restoration request for the target characters in the text file by clicking the full-text restoration control within the window of the text editor or by using the full-text restoration shortcut key, so as to request the text editor to restore all the target characters in the text file to the initial key characters.
[0066] Next, traverse the text content in the text file to find one or more target characters included in the text content. Here, after each target character is found, the restoration position corresponding to the target character can be determined, and then each target character can be successively restored to the key character based on the restoration position of each target character.
[0067] It can be understood that the number of target characters included in the text content after the full-text replacement is the same as the number of key characters included in the text content before the full-text replacement. Therefore, here, based on the same initial replacement speed as the full-text replacement process, by traversing the restoration positions of each target character in the text content, each target character in the text content can be successively restored to the key character until the full-text restoration process is completed.
[0068] It should also be noted that during the process of successively restoring each target character in the text content to the target character, a control interface can also be displayed on the system desktop of the computing device. The user can control the full-text restoration process based on the control interface. For example, the restoration speed can be adjusted by operating the adjustment control, and the restoration process can be paused by clicking the pause control. In addition, information such as the current restoration speed and the remaining restoration time can also be displayed on the control interface. Here, for the specific operation method, refer to the description of the full-text replacement process in the foregoing text, which will not be elaborated here.
[0069] Figure 3 FIG. shows a schematic diagram of a text editor 300 according to an embodiment of the present invention. The text editor 300 resides in a computing device (such as the aforementioned computing device 100). As Figure 3 shown, the text editor 300 includes a full-text replacement device 350.
[0070] As Figure 3 shown, the full-text replacement device 350 includes a receiving unit 351, a searching unit 352, a determining unit 353, and a replacing unit 354 that are connected in sequence. Among them, the receiving unit 351 can receive a full-text replacement request (or full-text restoration request) for the key characters in the text file. The searching unit 352 traverses the text content in the text file to search for one or more key characters (or target characters) included in the text content. The determining unit 353 can determine the initial replacement speed according to the number of key characters included in the text content. The replacing unit 354 can, based on the initial replacement speed, successively replace each key character in the text content with the target character until the full-text replacement is completed. In addition, the replacing unit 354 can also, based on the initial replacement speed, successively restore each target character in the text content to the key character.
[0071] It should be noted that the receiving unit 351 is used to execute the foregoing step S210, the searching unit 352 is used to execute the foregoing step S220, the determining unit 353 is used to execute the foregoing step S230, and the replacing unit 354 is used to execute the foregoing step S240. Here, for the specific execution logic of the receiving unit 351, the searching unit 352, the determining unit 353, and the replacing unit 354, refer to the description of steps S210 to S240 in the foregoing method 200, which will not be elaborated here.
[0072] According to the full-text replacement solution of the present invention, when a user requests to perform full-text replacement on key characters, each key character in the text content is successively replaced with the target character, rather than all the key characters in the text content being replaced with the target character at once and uniformly. Based on this, for large text files, in the case where there are many key characters to be replaced in the text content, the successive replacement method can avoid occupying too much memory resources, thereby avoiding the problem of lag during the use of the text editor. In addition, the present invention determines the initial replacement speed according to the number of key characters to be replaced in the text content, and replaces the key characters in the text content based on the determined initial replacement speed. In this way, the replacement speed is reasonably controlled according to the number of key characters to be replaced, so as to avoid taking a long time in the case of a large number of key characters to be replaced, and ensure that the replacement efficiency is improved as much as possible without lagging.
[0073] In addition, the present invention displays a control interface during the replacement process. In this way, during the full-text replacement process, the user can adjust the replacement speed and pause the replacement process based on the control interface according to the actual situation and needs, so as to meet the user's needs as much as possible and improve the user experience.
[0074] A7. The method according to any one of A1 - A6, wherein the step of finding one or more key characters included in the text content comprises: determining the replacement position corresponding to each key character; and successively replacing each key character in the text content with the target character comprises: traversing the replacement positions corresponding to each key character, and successively replacing each key character in the text content with the target character based on each replacement position.
[0075] A8. The method according to any one of A1 - A7, wherein the step of determining the initial replacement speed according to the number of key characters included in the text content comprises: when n ≤ 10 6 , f(n) = 10 characters per second; when n > 10 6 , f(n) = 10 * (n / 10 6 ) characters per second; where n represents the number of key characters, and f(n) represents the initial replacement speed.
[0076] A9. The method according to any one of A1 - A8, further comprising the step of: checking whether each key character in the text content has been replaced with the target character. If so, display a message indicating that the replacement is completed, and display the text content after the replacement; if not, determine that the replacement fails, display a message indicating that the replacement fails, and display the number of key characters that have been replaced.
[0077] A10. The method according to any one of A1 - A9, wherein after completing the full - text replacement, the method further includes the steps of: receiving a full - text restoration request for a target character in the text file; traversing the text content in the text file to find one or more target characters included in the text content; and based on the initial replacement speed, sequentially restoring each target character in the text content to the key character until the full - text restoration is completed.
[0078] The various technologies described herein can be implemented in combination with hardware or software, or a combination thereof. Thus, the method and device of the present invention, or certain aspects or parts of the method and device of the present invention, may take the form of program code (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, a USB flash drive, a floppy disk, a CD - ROM, or any other machine - readable storage medium. When the program is loaded into a machine such as a computer and executed by the machine, the machine becomes a device for practicing the present invention.
[0079] In the case where the program code is executed on a programmable computer, the computing device generally includes a processor, a processor - readable storage medium (including volatile and non - volatile memory and / or storage elements), at least one input device, and at least one output device. Among them, the memory is configured to store the program code; the processor is configured to execute the full - text replacement method of the present invention according to the instructions in the program code stored in the memory.
[0080] By way of example and not limitation, the readable medium includes a readable storage medium and a communication medium. The readable storage medium stores information such as computer - readable instructions, data structures, program modules, or other data. The communication medium generally embodies computer - readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and includes any information - delivery medium. A combination of any of the above is also included within the scope of the readable medium.
[0081] In the specification provided herein, the algorithms and displays are not inherently related to any particular computer, virtual system, or other device. Various general - purpose systems can also be used in conjunction with the examples of the present invention. Based on the above description, the structure required to construct such a system is obvious. In addition, the present invention is not directed to any particular programming language. It should be understood that the content of the present invention described herein can be implemented using various programming languages, and the description of the specific language above is to disclose the best mode of the present invention.
[0082] In the specification provided herein, a large number of specific details are set forth. However, it can be understood that the embodiments of the present invention can be practiced without these specific details. In some instances, well - known methods, structures, and technologies have not been shown in detail so as not to obscure the understanding of this specification.
[0083] Similarly, it should be understood that, in order to streamline the present disclosure and assist in understanding one or more of the various inventive aspects, in the foregoing description of the exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together in a single embodiment, figure, or description thereof. However, the disclosed method should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, the inventive aspects lie in less than all the features of the single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate embodiment of the present invention.
[0084] Those skilled in the art should understand that the modules, units, or components of the devices in the examples disclosed herein may be arranged in the devices as described in the embodiments, or alternatively may be located in one or more devices different from those in the examples. The modules in the foregoing examples may be combined into one module or further divided into multiple sub-modules.
[0085] Those skilled in the art can understand that the modules in the devices of the embodiments can be adaptively changed and arranged in one or more devices different from those of the embodiments. The modules, units, or components in the embodiments can be combined into one module, unit, or component, and furthermore can be divided into multiple sub-modules, sub-units, or sub-components. Except that at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all the features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all the processes or units of any method or device so disclosed. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) can be replaced by an alternative feature that provides the same, equivalent, or similar purpose.
[0086] In addition, those skilled in the art can understand that, although some of the embodiments described herein include certain features included in other embodiments rather than other features, the combination of the features of different embodiments means that it is within the scope of the present invention and forms different embodiments. For example, in the following claims, any one of the claimed embodiments can be used in any combination.
[0087] In addition, some of the embodiments described herein are methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices performing the functions. Accordingly, a processor having the necessary instructions for implementing the method or method elements constitutes an apparatus for implementing the method or method elements. In addition, the elements described herein of the apparatus embodiments are examples of apparatuses that perform the functions performed by the elements for the purpose of implementing the invention.
[0088] As used herein, unless otherwise specified, the use of ordinal numbers such as "first", "second", "third", etc. to describe ordinary objects merely indicates different instances of similar objects and is not intended to imply that the objects so described must have a given order in time, space, ranking, or in any other manner.
[0089] Although the invention has been described in terms of a limited number of embodiments, those skilled in the art within the present technical field will appreciate, upon the benefit of the foregoing description, that other embodiments can be contemplated within the scope of the invention as thus described. In addition, it should be noted that the language used in this specification has been principally selected for readability and instructional purposes and not for the purpose of explaining or limiting the subject matter of the invention. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. For the scope of the invention, the disclosure of the invention is illustrative and not restrictive, and the scope of the invention is defined by the appended claims.
Claims
1. A full - text replacement method, which is executed in a text editor, including the steps: Receiving a full - text replacement request for a key character in a text file; Traversing the text content in the text file to find one or more key characters included in the text content; Determining an initial replacement speed according to the number of key characters included in the text content; and Based on the initial replacement speed, sequentially replacing each key character in the text content with a target character until the full - text replacement is completed.
2. The method according to claim 1, wherein It further includes the steps: Displaying a control interface so that the user can control the full - text replacement process based on the control interface.
3. The method according to claim 2, wherein, It further includes the steps: Receiving an adjustment instruction for the replacement speed sent on the control interface, and determining a new replacement speed after adjustment according to the adjustment instruction; According to the new replacement speed, sequentially replacing each remaining key character with a target character.
4. The method according to claim 2, wherein It further includes the steps: Receiving a pause replacement instruction sent on the control interface and pausing the replacement of the remaining key characters.
5. The method according to claim 2, wherein, It further includes the steps: Receiving a termination replacement instruction sent on the control interface, terminating the replacement of the remaining key characters, and restoring the replaced key characters.
6. The method according to claim 2, wherein, It further includes the steps: Determining the replacement time required to complete the full - text replacement according to the initial replacement speed and the number of key characters, and displaying the replacement time on the control interface; During the process of sequentially replacing each key character in the text content with a target character, it further includes the steps: Determining the remaining number of key characters, determining the remaining replacement time required to complete the full - text replacement according to the current replacement speed and the remaining number, and displaying the remaining replacement time on the control interface to update the replacement time.
7. The method according to any one of claims 1-6, wherein The step of finding one or more key characters included in the text content includes: determining the replacement position corresponding to each key character; Sequentially replacing each key character in the text content with a target character includes: Traversing the replacement positions corresponding to each key character, and sequentially replacing each key character in the text content with a target character based on each replacement position.
8. The method according to any one of claims 1-7, wherein The step of determining the initial replacement speed according to the number of key characters included in the text content includes: When n ≤ 10 6 , f(n) = 10 pieces / second; When n > 10 6 , f(n) = 10 * (n / 10 6 ) pieces per second; Where n represents the number of key characters, and f(n) represents the initial replacement speed.
9. The method according to any one of claims 1-8, wherein It further includes the steps: Checking whether each key character in the text content has been replaced with a target character. If so, displaying a message indicating that the replacement is completed, and displaying the text content after the replacement; If not, determining that the replacement fails, displaying a message indicating that the replacement fails, and displaying the number of replaced key characters.
10. The method according to any one of claims 1-9, wherein, After completing the full - text replacement, it further includes the steps: Receiving a full - text restoration request for the target character in the text file; Traversing the text content in the text file to find one or more target characters included in the text content; Based on the initial replacement speed, sequentially restoring each target character in the text content to the key character until the full - text restoration is completed.
11. A full - text replacement device, which resides in a text editor, and the device includes: A receiving unit, adapted to receive a full - text replacement request for a key character in a text file; A search unit, adapted to traverse the text content in a text file to search for one or more key characters included in the text content; A determination unit, adapted to determine an initial replacement speed according to the number of key characters included in the text content; And A replacement unit, adapted to sequentially replace each key character in the text content with a target character based on the initial replacement speed until the full-text replacement is completed.
12. A text editor, comprising a full-text replacement device, the full-text replacement device being adapted to execute the method according to any one of claims 1-10.
13. A computing device, comprising: At least one processor; And A memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, and the program instructions include instructions for executing the method according to any one of claims 1-10.
14. A readable storage medium storing program instructions, when the program instructions are read and executed by a computing device, causing the computing device to execute the method according to any one of claims 1-10.
Citation Information
Patent Citations
Estimating time remaining for an operation
CN105144116A
Data processing method and device
CN112347142A