multiline

How to center a two-line text in a TextView on Android?

一世执手 提交于 2019-12-04 14:55:04
问题 I want to let it looks like this: | two | | lines | Here is the current layout, not working at all. <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="two\nlines" android:layout_gravity="center_vertical" android:layout_centerInParent="true"/> </RelativeLayout> Any idea? Thanks! 回答1: If you just want to center it (I'm assuming

Issue parsing multiline JSON file using Python

限于喜欢 提交于 2019-12-04 07:33:32
I am trying to parse a JSON multiline file using json library in Python 2.7. A simplified sample file is given below: { "observations": { "notice": [ { "copyright": "Copyright Commonwealth of Australia 2015, Bureau of Meteorology. For more information see: http://www.bom.gov.au/other/copyright.shtml http://www.bom.gov.au/other/disclaimer.shtml", "copyright_url": "http://www.bom.gov.au/other/copyright.shtml", "disclaimer_url": "http://www.bom.gov.au/other/disclaimer.shtml", "feedback_url": "http://www.bom.gov.au/other/feedback" } ] } } My code is as follows: import json with open('test.json',

how do i create a multiline string in EditText?

痴心易碎 提交于 2019-12-04 07:08:37
问题 i want to display a string in a multiline EditText. Currently, the string displays as.... Receive: 0 coin(s) Total Cost: $100 I want want it to display as... Receive: 0 coin(s) Total Cost: $10 This is my code, I have tried to use "\n", but to no avail... result.setText("Receive:"+ " "+ df.format(rawounces)+"coin(s)" + "\n" + "Total Cost:$" + df.format(transactionandpremium*rawounces)); Thank you in advance. 回答1: You can use the android:minLines="3" for display the multiline in edittext. and

sed or awk multiline replace

此生再无相见时 提交于 2019-12-04 05:58:21
I am trying to append formatting to all /* TODO : ... */ tags, but I am having trouble in the multi-line area. I can do single line sed's; but for multiline sed and awk, I don't know. How do I do this? I'm open to either. Here's what I have so far. sed 's/\/\/\*[ \t]*TODO[ \t]*:.*/*\//<span style="color:#aaaaaa;font-weight:bold;">&</span>/g' replace : int void main ( int h, char * argv[] ) int a, b; /* TODO : - include libraries ... */ foobar(); /* TODO : fix missing {'s */ with : int void main ( int h, char * argv[] ) int a, b; <span style="color:#aaaaaa; font-weight:bold;">/* TODO : -

Save the value from Multiline Textbox into SQL Server with line brea

我是研究僧i 提交于 2019-12-04 05:23:47
问题 I got one multiline textbox call txtDesc. The user can key in multiline value such as : Hai. I'm robot. Please feed me. I want to save into database with the line break and will display it back later as user key in. if i save the value as below code, the line break will not save. dim strDesc as string = txtDesc.text how to make this happen? Thank you. 回答1: Love the sample text :) How are you saving and loading this to/from SQL ? If I have a multiline textbox, the .Text property includes the

Capture multiline, multi-group to Powershell variables

本小妞迷上赌 提交于 2019-12-04 04:37:16
问题 Ideally, I would like to create an object from ipconfig that allows us to drilldown to each adapter's attributes like this: $ip.$lan.$mac for the lan adapter's mac address. To start, I would like to develop a way to capture these 3 groups (adapter type, adapter name, adapter attributes) per adapter match into Powershell variables (objects are preferred): https://regex101.com/r/wZ3sV1/1 Here are some ideas to capture three parts of the Ethernet adapter section, but they are only capturing

How do I fix this multiline regular expression in Ruby?

笑着哭i 提交于 2019-12-04 04:14:43
I have a regular expression in Ruby that isn't working properly in multiline mode. I'm trying to convert Markdown text into the Textile-eque markup used in Redmine. The problem is in my regular expression for converting code blocks. It should find any lines leading with 4 spaces or a tab, then wrap them in pre tags. markdownText = '# header some text that precedes code var foo = 9; var fn = function() {} fn(); some post text' puts markdownText.gsub!(/(^(?:\s{4}|\t).*?$)+/m,"<pre>\n\\1\n</pre>") Intended result: # header some text that precedes code <pre> var foo = 9; var fn = function() {} fn(

How can I match multi-line patterns in the command line with perl-style regex?

ⅰ亾dé卋堺 提交于 2019-12-04 04:10:40
问题 I regularly use regex to transform text. To transform, giant text files from the command line, perl lets me do this: perl -pe < in.txt > out.txt But this is inherently on a line-by-line basis. Occasionally, I want to match on multi-line things. How can I do this in the command-line? 回答1: To slurp a file instead of doing line by line processing, use the -0777 switch: perl -0777 -pe 's/.../.../g' in.txt > out.txt As documented in perlrun #Command Switches: The special value -00 will cause Perl

Regex options matching multi-line as well as ignoring the case

时光总嘲笑我的痴心妄想 提交于 2019-12-04 04:05:19
问题 I have some piece of ill-formed html, sometimes the " is missing. Also, it sometimes shows capital cases while other times lower cases: <DIV class="main"> <DIV class="subsection1"> <H2> <DIV class=subwithoutquote>StackOverflow</DIV></H2></DIV></DIV> I would like to match both multi-line and ignoring the case. But the following patern does not seem to be working. (For the concatenation, I also tried | instead of &) const string pattern = @"<div class=""?main""?><div class=""?subsection1""?><h2

How is CheckBox with multi-line text done in Windows Forms?

自作多情 提交于 2019-12-03 23:58:58
How do I extend the text in a Windows Forms CheckBox to more than one line? You need to use \r\n in order to add a new line. You might have to do this in the code behind. So your code would be like this: myLabel.Text = "New\r\nLine\r\nExample"; First you should turn autosize property to False. Then resize the box and use \r\n for going to next line. 来源: https://stackoverflow.com/questions/5937637/how-is-checkbox-with-multi-line-text-done-in-windows-forms