Questions tagged [text]

Text is a sequence of printable characters.

Text is a sequence of printable characters.

Text can be unformatted (plain) or formatted (rich).

The most common character codes used for representing text are Unicode and ASCII:

  • ASCII is a character code and an encoding.
  • Unicode is a complex standard, with multiple encodings, the most common of which is UTF-8.
31743 questions
297
votes
11 answers

Check if string contains only whitespace

How can I test if a string contains only whitespace? Example strings: " " (space, space, space) " \t \n " (space, tab, space, newline, space) "\n\n\n\t\n" (newline, newline, newline, tab, newline)
bodacydo
  • 75,521
  • 93
  • 229
  • 319
260
votes
17 answers

How can I print bold text in Python?

E.g: print "hello" What should I do to make the text "hello" bold?
Jia-Luo
  • 3,023
  • 5
  • 16
  • 17
260
votes
5 answers

How I can delete in VIM all text from current line to end of file?

I have very large files (more than 10Gb). I need only some lines from the top of the file. Is it possible (in vim) to delete the rest of the file (from current line to the end of file)?
user810430
  • 11,181
  • 15
  • 38
  • 43
252
votes
7 answers

Find text string using jQuery?

Say a web page has a string such as "I am a simple string" that I want to find. How would I go about this using JQuery?
Keith Donegan
  • 26,213
  • 34
  • 94
  • 129
247
votes
13 answers

How do I center text vertically and horizontally in Flutter?

I'd like to know how to center the contents of a Text widget vertically and horizontally in Flutter. I only know how to center the widget itself using Center(child: Text("test")) but not the content itself. By default, it's aligned to the left. In…
jeroen-meijer
  • 2,664
  • 2
  • 13
  • 16
247
votes
19 answers

Quick unix command to display specific lines in the middle of a file?

Trying to debug an issue with a server and my only log file is a 20GB log file (with no timestamps even! Why do people use System.out.println() as logging? In production?!) Using grep, I've found an area of the file that I'd like to take a look at,…
matt b
  • 138,234
  • 66
  • 282
  • 345
245
votes
10 answers

UILabel Align Text to center

How do I align text in UILabel?
vivianaranha
  • 2,781
  • 6
  • 33
  • 47
244
votes
20 answers

Set color of TextView span in Android

Is it possible to set the color of just span of text in a TextView? I would like to do something similar to the Twitter app, in which a part of the text is blue. See image below: (source: twimg.com)
hpique
  • 119,096
  • 131
  • 338
  • 476
239
votes
7 answers

How can I use a batch file to write to a text file?

I need to make a script that can write one line of text to a text file in the same directory as the batch file.
09stephenb
  • 9,358
  • 15
  • 53
  • 91
235
votes
18 answers

Remove blank lines with grep

I tried grep -v '^$' in Linux and that didn't work. This file came from a Windows file system.
node ninja
  • 31,796
  • 59
  • 166
  • 254
232
votes
5 answers

SVG: text inside rect

I want to display some text inside SVG rect. Is it possible? I tried
Jakub M.
  • 32,471
  • 48
  • 110
  • 179
232
votes
33 answers

In React ES6, why does the input field lose focus after typing a character?

In my component below, the input field loses focus after typing a character. While using Chrome's Inspector, it looks like the whole form is being re-rendered instead of just the value attribute of the input field when typing. I get no errors from…
spunge
  • 2,827
  • 3
  • 14
  • 12
232
votes
0 answers

Decode & back to & in JavaScript

I have strings like var str = 'One & two & three'; rendered into HTML by the web server. I need to transform those strings into 'One & two & three' Currently, that's what I am doing (with help of…
Art
  • 23,747
  • 29
  • 89
  • 101
229
votes
8 answers

How to modify a text file?

I'm using Python, and would like to insert a string into a text file without deleting or copying the file. How can I do that?
Oscar
222
votes
7 answers

How to read a text file into a list or an array with Python

I am trying to read the lines of a text file into a list or array in python. I just need to be able to individually access any item in the list or array after it is created. The text file is formatted as follows: 0,0,200,0,53,1,0,255,...,0. Where…
user2037744
  • 2,245
  • 2
  • 13
  • 3