Paste multiple lines inside tags as separate line each - Sublime text - line

I have to set a list of title/authors item inside an html page, with each title/author line inside a <li> like this:
<ul>
<li> title name - <em>author name</em></li>
<li> title name - <em>author name</em></li>
<li> title name - <em>author name</em></li>
and so on...
</ul>
They gave me an Excel file with two columns, one for title and one for authors, with about 90-100 rows.
What is the best and quickest way to obtain a list with <li>s like those stated above? (I use Sublime Text 2)
Simply copy/pasting inside Sublime Text 2, i have a separate line for each title/author row, like this
title name author name
title name author name
title name author name
nothing else..
I can easely wrap every single line inside an <li> thx to:
menu Selection -> Split into Lines (Cmd/Ctlr + Shift + L)
and typing the tags, but then i'm stuck to insert, in a sort of automated way, the dash ( - ) after the titles and the <em>s for the authors.
My best guess is (but I really don't know how to do that) to find a way to copy/paste a bunch of lines and then paste them where every single cursor stand, each as a separate line like this (consider the | as the cursor):
*copy* authors name as single lines
|author name1
|author name2
|author name3
|author name4
*paste* authors as single line each where the cursor "|" stands
<li>title name - <em> |author name1 </em></li>
<li>title name - <em> |author name2 </em></li>
<li>title name - <em> |author name3 </em></li>
<li>title name - <em> |author name4 </em></li>
Unfortunately what actually happens (in sublime text 2) is this:
<li>title name - <em> |author name1
author name2
author name3
author name4 </em></li>
<li>title name - <em> |author name1
author name2
author name3
author name4 </em></li>
<li>title name - <em> |author name1
author name2
author name3
author name4 </em></li>
<li>title name - <em> |author name1
author name2
author name3
author name4 </em></li>
all the copied lines simply get pasted in block for every single cursor

Probably you only have to verify that the number of lines copied to the clipboard matches the number of lines splitted with CMD+SHIFT+L.
If they match, Sublime Text behaves as you expected, copying each source line to each destination line (at least on my machine... :).

I actually just found the answer to this, and wanted to share just in case anyone else encounters this. Riccardo is right but I can expand.
Sublime will paste in chunks when you expect to paste in place when there is not a match between the number of sources and targets. I've encountered your bug when there's an extra hard return or extra element. So for example.
|author name1
|author name2
Will trigger Sublime to paste the two values into place because there are two source values and one target element.
<li>title name - <em> |author name1
author name2 </em></li>
So to Riccard's point, you likely might have had selected a little extra that Sublime recognized as a extra value.
So to fix this, you'll need to have equal sources and targets.
|author name1
|author name2
<li>title name - <em> |author name1 </em></li>
<li>title name - <em> |author name2 </em></li>

Related

access) How can I match the name in the column from a new input data?

I have a "Name" column with a format of "last name first name",
however if there is a different format of name column in a new data which should be matched to my original data, how can I make it to be matched automatically??
For example ,
I have :
Name
Jane Carr
Tony Kwon
and the new data has :
Name
Ms. Jane or Jane, Carr
Mr. Tony or Tony, Kwon
how can these two names can be automatically matched to my original data of Jane Carr and Tony Kwon?
I use 'like' to match the strings if the entire string is unknown in the where clause after the column name.
select * from table_name where name like '%jane carr%';
This is a wild card.
% before the string means - search all which has name ending with mentioned string.
% after the string means - search all which has name starting with mentioned string.
% before and after means - search all which has matching string.

SQL pad column content with tabs instead of spaces

I am dynamically creating a column via a SELECT statement. The content of this column is a string which is then used as content for an e-mail.
The text looks like this:
text 1 | text 2 | text 3 | ...
text 123 | text 223 | text 323 | ...
as you see, the two lines are not aligned. The expected output should be like this:
text 1 | text 2 | text 3 | ...
text 123 | text 223 | text 323 | ...
The obvious solution is to pad each field in order for each field to have the same size. for this i used the following code:
LEFT(field1 + REPLICATE(' ', 20), 20)
My issue is, that in Outlook the text is still not shown properly aligned even though, if I copy the text into Notepad, it is properly aligned. The reason is, that Outlook uses Arial for displaying text-mails and in Arial blank-spaces do not have the same size as the other characters. Hence the padding does not yield the expected result.
My question now is: Is there some other way to use this padding approach in order to get same size displayed fields in Outlook Mails? Probably by padding with tabs? But I think my approach above then does not work anymore...
Regarding the TAB, it dawned on me that you were talking about trailing tabs
Declare #Table table (SomeField varchar(50))
Insert into #Table values
('Some Text'),
('Some Longer Text with more')
Select String = SomeField+replicate(char(9),(30-Len(SomeField))/4)+'|'
From #Table
Returns
Some Text |
Some Longer Text with more |
If you don't want (or can't) create the HTML as #techspider and #Shnugo mentioned, you could simply cast your string as a char(20)
cast(field1 as char(20))
For Example
Select '| '+cast('text1' as char(20))+' | '+cast('text1' as char(20))+'|'
Returns
| text1 | text1 |

Selenium IDE: how to verify the stored text without some symbol

I store the text in the format "№XXX"
storeText | css=span.ng-binding | order_number
I need to verify this text in the other location using:
verifyText | //div[#id='myorders']/div/table/tbody/tr[1]/td | ${order_number}.
The problem is that in that location this text is displayed without the symbol "№" - "XXX" only.
How i can to verify the match of this text?
If the text in one location has the leading character, but not in the other, then after you save the string, strip off the first character and compare to that. You can use any number of methods to do that (see Delete first character of a string in Javascript).
Klendathu
I found the solution:
storeText | css=span.ng-binding | order_number
storeEval | storedVars['order_number'].replace('№','') | order_number

How to remove unwanted spaces between the text in excel2007

I want to remove or delete the extra spaces in character value. For example the col contains the name data like:
"sachin sa meer pa war"
Actually i want this in one line with only 2 spaces like:
"sachin sameer pawar"
This will make me easy to text to col function.
So how can i remove those two unwanted spaces which is in between the middle name and in last name?
Since you specifically mention "those two unwanted spaces":
=SUBSTITUTE(SUBSTITUTE(A4," ","",2)," ","",3)

Oracle trim whitespace on the inside of a string

I am storing phone numbers as VARCHAR2 in my system to allow for users to input '+' characters infront of their phone number if they so choose.
My regexp allows for this perfectly, but when storing the number in the database I want to strip out all whitespace the user may enter.
My regexp allows for the following formats
+4470123456789
+447 0123456789
+447 01234 56789
01234567890
01234 567890
01234 567 890
I know I could resolve my issue by not letting users put any whitespace in their numbers, but I know from personal experience just how frustrating it is to have a validation error due to some silly formatting on the client side. I have tried using the TRIM function on my INSERT/UPDATE trigger but I have realised that is limited to only front and trailing whitespace, is there any other function in Oracle I could use that would remove internal whitespace? Or do I need to write my own function to do this?
Any pointers would be greatly appreciated.
You want to try replace (telno, ' ', '').
a better approach is to use a regular expression to remove all spaces within a string
SQL> with t as (
select 'AAA BBB CCC' col from dual union
select 'DDDD EEE F' col from dual
)
--
-- actual query:
--
select regexp_replace(col, '[[:space:]]+', chr(32)) col
from t;
COL
AAA BBB CCC
DDDD EEE F