CN110018863B - Mobile terminal text display method, storage medium, equipment and system - Google Patents

Mobile terminal text display method, storage medium, equipment and system Download PDF

Info

Publication number
CN110018863B
CN110018863B CN201810019593.4A CN201810019593A CN110018863B CN 110018863 B CN110018863 B CN 110018863B CN 201810019593 A CN201810019593 A CN 201810019593A CN 110018863 B CN110018863 B CN 110018863B
Authority
CN
China
Prior art keywords
text
type
webpage
original text
original
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810019593.4A
Other languages
Chinese (zh)
Other versions
CN110018863A (en
Inventor
汪刚
张文明
陈少杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201810019593.4A priority Critical patent/CN110018863B/en
Publication of CN110018863A publication Critical patent/CN110018863A/en
Application granted granted Critical
Publication of CN110018863B publication Critical patent/CN110018863B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • G06F3/0483Interaction with page-structured environments, e.g. book metaphor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a mobile terminal text display method, a storage medium, equipment and a system, which relate to the field of application development of internet mobile terminals and comprise the steps of obtaining an original text to be displayed, and converting a special symbol in the original text from an initial type into a webpage type to obtain a target text; replacing and expressing the target text by using an HTML language to obtain a webpage text; and creating a WebView object of the UIWebView type, and loading webpage text by using the WebView. The invention can smoothly display large-scale texts by type conversion, HTML language replacement and loading texts by using a WebView object WebView of the UIWebView type.

Description

Mobile terminal text display method, storage medium, equipment and system
Technical Field
The invention relates to the field of application development of internet mobile terminals, in particular to a mobile terminal text display method, a storage medium, equipment and a system.
Background
When the content required to be displayed on some pages is many times, such as text and pictures displayed when people watch news, the data of the pages are loaded step by step, the content is small, generally within 10 ten thousand bytes, and the mobile terminal can be displayed to users smoothly.
However, with the rapid development of mobile terminals, mobile terminals of mobile phones need to display more and more information. Situations arise where more than 10 kilobytes need to be presented, which creates a problem of display data not being smooth. In the prior art, texts to be displayed are downloaded and read firstly, and then the display area is calculated according to the number of the texts, when a large number of texts are displayed in the manner, resources of a mobile terminal are occupied, so that the mobile terminal is blocked and the texts are displayed at intervals for a long time. Therefore, it is urgently needed to provide a smooth information flow display scheme, which can automatically adapt to the height of a text without calculating the height of the text, and can realize a smooth browsing effect by using a cache-free strategy of a system.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a mobile terminal text display method, which is used for preventing a mobile terminal from being stuck because the mobile terminal occupies less resources when browsing large-scale texts.
In order to achieve the above purposes, the technical scheme adopted by the invention is as follows:
a mobile terminal text display method comprises the following steps:
acquiring an original text to be displayed, and converting a special symbol in the original text from an initial type into a webpage type to obtain a target text;
replacing and expressing the target text by using an HTML language to obtain a webpage text;
and creating a WebView object of the UIWebView type, and loading webpage text by using the WebView.
On the basis of the above technical solution, the step of converting the special symbol in the original text from the initial type to the webpage type to obtain the target text specifically includes:
acquiring a regular table, wherein the regular table comprises the initial type of the special symbol and the corresponding relation of the webpage type;
and segmenting the original text, and replacing the special symbols in the original text segment by segment from the initial type to the webpage type according to a regular table.
On the basis of the technical scheme, segmenting the original text specifically comprises the following steps: the original text is divided into a plurality of fields according to the segmentation symbol positions of the original text.
The invention also provides a storage medium having stored thereon a computer program which, when executed by a processor, implements the method described above. The mobile terminal using the storage medium occupies less resources when browsing large-scale texts, and prevents the mobile terminal from being stuck.
The invention also provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program running on the processor, and the processor implements the method when executing the computer program. The electronic equipment occupies less resources when browsing large-scale texts, and prevents blockage.
The present invention also provides a mobile terminal text display system, which includes:
the first unit is used for acquiring an original text to be displayed and converting a special symbol in the original text from an initial type into a webpage type to obtain a target text;
the second unit is used for replacing and expressing the target text by using an HTML language to obtain a webpage text;
and the third unit is used for creating a WebView object of the UIWebView type and loading the webpage text by using the WebView.
The system occupies less resources when browsing large-scale texts, and prevents the mobile terminal from being blocked.
On the basis of the above technical solution, the first unit includes:
a segmentation subunit to segment an original text into a plurality of fields;
a conversion subunit for replacing the special symbols in the original text from the initial type to the web page type segment by segment according to a regular table.
On the basis of the technical scheme, the initial type is a character string type.
On the basis of the technical scheme, the segmentation subunit performs segmentation according to the segmentation symbols of the original text.
On the basis of the technical scheme, the conversion subunit and the segmentation subunit are static functions.
Compared with the prior art, the invention has the advantages that:
(1) the invention can smoothly display large-scale texts by type conversion, HTML language replacement and loading texts by using a WebView object WebView of the UIWebView type, occupies less resources and prevents mobile terminal blockage.
(2) The invention uses the regular table to convert the special symbols in the text to be displayed, so that messy codes can not appear in the display.
(3) According to the method, the original text is divided into a plurality of fields, so that the replacement can be carried out more quickly, and the operation is smoother.
(4) The invention replaces special characters with static functions and variables, so that the conversion is only carried out once, and the conversion is safer.
Drawings
FIG. 1 is a flow chart of a mobile terminal text display method according to the present invention;
fig. 2 is a structural diagram of a mobile terminal text display system according to the present invention.
Detailed Description
Interpretation of terms:
origString: the parameter origString is used only as a name of a parameter for storing original text, and may be replaced by origtxt or the like as long as it can function to store the original text.
UIWebView object of WebView object: WebView objects created under UIweb type can be used to embed web page content, typically html formatted web pages, in an App. The method has the advantages that platforms such as iOS and Android can be deployed once, the platforms are published at a server, terminal display can be updated in real time, quick upgrading and bug emergency repair are facilitated, typesetting and layout capabilities are high, and the like.
scalesPageToFit: after loading an HTML page by using an object of UIWebView type, displaying the HTML page in the original size of the page, if the size of the page exceeds the size of a viewport of the UIWebView, the UIWebView can generate a scrolling effect, a user can only view contents in different areas by scrolling the page, the page can not be enlarged or reduced by using a finger kneading gesture, but after setting scalesPageToFit as yes, the user can adapt to the size of the viewport of the user by zooming the HTML page, and therefore the effect of displaying the contents in a whole screen is achieved.
Embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
Referring to fig. 1, an embodiment of the present invention provides a mobile terminal text display method, including:
s1: acquiring an original text, and converting a special symbol in the original text from an initial type into a webpage type to obtain a target text; the method comprises the following steps:
s101, creating a static parameter origString, and storing an original text by using the origString, wherein the original text is a text of a character string type;
s102, establishing a static regular table dic which stores the relation of the special symbols in the character string type corresponding to the webpage type, for example, ">" of the character string type is "& gt" in the HTML language, "<" of the character string type is "& lt" in the HTML language, and "& raquo" of the character string type is "& raquo" in the HTML language;
s103, establishing a method for converting the special symbols of the original text in origString from the character string type to the webpage type according to the regular table dic to obtain the target text.
The steps define a conversion method for converting the character string into the webpage text, and convert the character string text into the webpage text by using the regular form character string, so that a 'bridge' is built, and the smooth conversion of the character string text and the webpage text is realized.
S2: replacing and expressing the target text by using an HTML language to obtain a webpage text; the method comprises the following steps:
s201, creating a parameter txt, using the parameter txt to store a target text,
s202, replacing and expressing the target text in the txt by using an HTML language, wherein if the title in the target text is < head > "title" </head >, and the body in the target text is expressed by < body > </body > in the HTML language to obtain a webpage text.
In the steps, the original language in the target text is replaced and expressed by the HTML language, so that when the text is loaded in a webpage mode, the phenomena that the text cannot be displayed or messy codes occur due to the fact that a webpage editing program cannot identify the text are avoided. Meanwhile, the text is displayed more smoothly and hierarchically.
S3: creating a WebView object of a UIWebView type, and loading a webpage text by using the WebView; the method comprises the following steps:
s301, creating a WebView object based on the UIWebView type, and setting the WebView, for example, setting the scalePageToFit attribute to be YES.
S302, loading webpage text by using webView.
In the steps, a large amount of texts are displayed by adding the webView control, the display content does not need to be cached, and the refreshing speed is high. When browsing large-scale texts, the mobile terminal occupies less resources and prevents the mobile terminal from being stuck.
Preferably, when the special symbols in the original text are converted from the initial type to the webpage type to obtain the target text, the original text is segmented, and the special symbols in the original text are replaced from the initial type to the webpage type section by section according to a regular table.
Specifically, a segmentation symbol in an original text is searched, the original text is divided into a plurality of fields by taking the segmentation symbol as a boundary, and then a special symbol in the field is converted into a webpage type from an original type such as a character string type section by section according to a regular table. The mode of replacing after segmentation can be used for circularly traversing each element taken into the array through the function, the extraordinary symbol in each element is changed into the corresponding HTML symbol type in the dictionary, and the replaced text can be obtained after replacement is finished, so that convenience and smoothness are realized, and the text can be more smoothly converted and displayed.
In addition, corresponding to the mobile terminal text display method, the present invention further provides a storage medium, where a computer program is stored on the storage medium, and when being executed by a processor, the computer program implements the steps of the timer setting method according to each of the embodiments. The storage medium includes various media capable of storing program codes, such as a usb disk, a removable hard disk, a ROM (Read-Only Memory), a RAM (Random Access Memory), a magnetic disk, or an optical disk.
In addition, corresponding to the mobile terminal text display method, the invention further provides an electronic device, where the electronic device stores a computer program, and the computer program, when executed by a processor, implements the steps of the timer setting method according to each of the embodiments. It should be noted that the electronic device includes a memory and a processor, where the memory stores a computer program running on the processor, and the processor executes the computer program to implement the steady moving terminal display method of the foregoing embodiment.
As shown in fig. 2, an embodiment of the present invention further provides a mobile terminal text display system, which includes a first unit, a second unit, and a third unit.
The first unit is used for acquiring an original text to be displayed and converting a special symbol in the original text from an initial type into a webpage type to obtain a target text. For example, ">" of a string type is "& gt" in the HTML language, "<" of a string type is "& lt" in the HTML language, "> >" of a string type is "& raquo" in the HTML language, and the like, ">" of a string type is "& lt" in the HTML language, "<" of a string type is "& lt" in the HTML language, "> >" of a string type is "& raquo" in the HTML language, and the like. The character string text is converted into the webpage text through the first unit, a bridge is built, and smooth conversion of the character string text and the webpage text is achieved. By changing the special symbols in each element in the text into the corresponding HTML symbol types in the dictionary, the text after being replaced can be obtained after the replacement is finished. The method is convenient and smooth, so that the text can be more smoothly converted and displayed.
The second unit is used for replacing and expressing the target text by using an HTML language to obtain a webpage text; the original language in the target text is replaced and expressed by the HTML language, so that when the text is loaded in a webpage mode, the phenomena that the text cannot be displayed or messy codes occur due to the fact that a webpage editing program cannot identify the text are avoided. Meanwhile, the text is displayed more smoothly and hierarchically.
And the third unit is used for creating a WebView object of the UIWebView type and loading webpage text by using WebView. Calling initWithNibName of a parent class to rewrite a controller initWithNibName, using UIWebView class to create a webView object by using a memory allocation method alloc and an initialization method init, storing the created object by using a defined attribute webView, and setting the scalesPageToFit attribute of the webView as yes. The webView is then used to load the web page text.
Preferably, the first unit includes a segmentation subunit configured to segment the original text into a plurality of fields, the regular table is configured to represent that the special symbols in the original text are converted from the original type to the web page type relationship, and the conversion subunit is configured to replace the special symbols in the original text from the original type to the web page type field by field according to a regular table that the original type used to represent the special symbols in the original text corresponds to the web page type relationship. The mode of replacing after segmentation can use a function to circularly traverse each element taken into the array, change the peculiar symbol in each element into the corresponding HTML symbol type in the dictionary, and obtain a text after replacement after the replacement is finished. The method is convenient and smooth, so that the text can be more smoothly converted and displayed. Further, since many existing text data transfers use a character string type, it is preferable to store the original text by using the character string type, so as to facilitate conversion in the subsequent steps.
Preferably, the segmentation subunit performs segmentation according to segmentation symbols of the original text. Segmentation after segmentation of the original text can be more convenient for further additions or replacements to HTML representation using HTML language, such as paragraphs to express using < h1> </h1 >.
Further, the segmentation subunit and the conversion subunit are both static functions, and the static functions are used for ensuring that the text file is processed and converted only once, so that the converted text is not converted again, and display errors are caused.
The present invention is not limited to the above-mentioned preferred embodiments, and any other products in various forms can be obtained by anyone with the teaching of the present invention, but any changes in the shape or structure thereof, which have the same or similar technical solutions as the present invention, are within the protection scope.

Claims (8)

1. A method for displaying a text on a mobile terminal, comprising:
acquiring an original text to be displayed, and converting a special symbol in the original text from an initial type into a webpage type to obtain a target text;
replacing and expressing the target text by using an HTML language to obtain a webpage text;
creating a WebView object of a UIWebView type, and loading a webpage text by using the WebView;
the method for converting the special symbols in the original text from the initial type to the webpage type to obtain the target text specifically comprises the following steps:
acquiring a regular table, wherein the regular table comprises the initial type of the special symbol and the corresponding relation of the webpage type;
and segmenting the original text, and replacing the special symbols in the original text segment by segment from the initial type to the webpage type according to a regular table.
2. The method for displaying mobile-end text according to claim 1, wherein segmenting the original text specifically comprises: the original text is divided into a plurality of fields according to the segmentation symbol positions of the original text.
3. A storage medium having a computer program stored thereon, characterized in that: which computer program, when being executed by a processor, carries out the method of claim 1 or 2.
4. An electronic device comprising a memory and a processor, the memory having stored thereon a computer program that runs on the processor, characterized in that: the processor, when executing the computer program, implements the method of claim or 2.
5. A mobile-side text display system, comprising:
the first unit is used for acquiring an original text to be displayed and converting a special symbol in the original text from an initial type into a webpage type to obtain a target text;
the second unit is used for replacing and expressing the target text by using an HTML language to obtain a webpage text;
the third unit is used for creating a WebView object of a UIWebView type and loading a webpage text by using the WebView;
the first unit includes:
a segmentation subunit for segmenting an original text into a plurality of fields;
a conversion subunit, configured to replace, segment by segment, a special symbol in the original text from the initial type to the web page type according to a regular table.
6. The mobile-end text display system of claim 5, wherein: the initial type is a string type.
7. The mobile-end text display system of claim 5, wherein: the segmentation subunit performs segmentation according to the segmentation symbols of the original text.
8. The mobile-end text display system of claim 5, wherein: the conversion subunit and the segmentation subunit are static functions.
CN201810019593.4A 2018-01-09 2018-01-09 Mobile terminal text display method, storage medium, equipment and system Active CN110018863B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810019593.4A CN110018863B (en) 2018-01-09 2018-01-09 Mobile terminal text display method, storage medium, equipment and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810019593.4A CN110018863B (en) 2018-01-09 2018-01-09 Mobile terminal text display method, storage medium, equipment and system

Publications (2)

Publication Number Publication Date
CN110018863A CN110018863A (en) 2019-07-16
CN110018863B true CN110018863B (en) 2022-05-10

Family

ID=67187775

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810019593.4A Active CN110018863B (en) 2018-01-09 2018-01-09 Mobile terminal text display method, storage medium, equipment and system

Country Status (1)

Country Link
CN (1) CN110018863B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110543265A (en) * 2019-07-22 2019-12-06 北京达佳互联信息技术有限公司 Page title bar generation method and device, electronic equipment and storage medium
CN111273903B (en) * 2020-01-10 2023-08-04 深圳市大富网络技术有限公司 Webpage making method and device, computer equipment and computer storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102799592A (en) * 2011-05-26 2012-11-28 腾讯科技(深圳)有限公司 Parsing method and system of rich text document
CN103513987A (en) * 2013-09-18 2014-01-15 小米科技有限责任公司 Rendering treatment method, device and terminal device for browser web page
CN104252444A (en) * 2013-06-27 2014-12-31 腾讯科技(北京)有限公司 Typesetting method, module and system for magazine application
CN106802937A (en) * 2016-12-30 2017-06-06 江苏中育优教科技发展有限公司 The conversion method and system of Word document

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102799592A (en) * 2011-05-26 2012-11-28 腾讯科技(深圳)有限公司 Parsing method and system of rich text document
CN104252444A (en) * 2013-06-27 2014-12-31 腾讯科技(北京)有限公司 Typesetting method, module and system for magazine application
CN103513987A (en) * 2013-09-18 2014-01-15 小米科技有限责任公司 Rendering treatment method, device and terminal device for browser web page
CN106802937A (en) * 2016-12-30 2017-06-06 江苏中育优教科技发展有限公司 The conversion method and system of Word document

Also Published As

Publication number Publication date
CN110018863A (en) 2019-07-16

Similar Documents

Publication Publication Date Title
CN109801347B (en) Method, device, equipment and medium for generating editable image template
US10839139B2 (en) Glyph aware snapping
WO2013109463A1 (en) Low resolution placeholder content for document navigation
CN104156207A (en) File display method and device
CN110018863B (en) Mobile terminal text display method, storage medium, equipment and system
KR102574306B1 (en) dynamic typesetting
CN104915186A (en) Method and device for making page
JP2021103552A (en) Method for labelling structured document information, device for labelling structured document information, electronic apparatus, computer readable storage medium, and computer program
CN101464986A (en) Method, system and device for establishing advertisement position
US20200258273A1 (en) Vector Graphic Font Character Generation Techniques
CN106970758A (en) Electronic document operation processing method, device and electronic equipment
CN107621951B (en) View level optimization method and device
AU2019341037B2 (en) Dynamically adjusting text strings based on machine translation feedback
CN107368236A (en) The methods of exhibiting and device of title in a kind of message catalog
CN117055987A (en) Webpage display method and device, electronic equipment and computer readable storage medium
JP2013020558A (en) Content data display device, content data display method, and program
US9223762B2 (en) Encoding information into text for visual representation
CN112765506B (en) Page text content display method, device, equipment and storage medium
JP5718839B2 (en) Method, system and computer-readable medium for moving labels to avoid overlap in graphic output
CN113095058B (en) Method and device for processing page turning of streaming document, electronic equipment and storage medium
CN114489639A (en) File generation method, device, equipment and storage medium
US8983827B2 (en) Linguistical analytic consolidation for mobile content
CN111611047A (en) Method and system for optimizing list performance of mobile App
US20190056851A1 (en) Processing objects on touch screen devices
CN114625460B (en) Image-text mixed arrangement method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant