I have a field that produces dates in 01-03-2022 - 07-03-2022 and want to put a line break after the 3rd hyphen so it displays like
01-03-2022 -
07-03-2022
Does anyone know how this can be achieved?
Try this...
=REPLACE(Fields!MyDatesField.Value, " - ", vbcrlf)
All we are doing is looking for the "space hyphen space" pattern and replaceing with the carriage return and line feed characters (equivalent to Chr(13) + Chr(10) as far as I remember)
Related
My problem is that I have a csv-file with alot of new line. How can I remove the newlines with select and replace? My other stuff should stay how it is.
Here the example:
101080;101080;101080;104;
101098;101098;101098;105;
101099;101099;101099;106;"RING 750GG 1BRI TW VS 0,0300ct 1 RUBIN WEITE58.0
BREITE 4.5mm
72-91872-0-0 045-71-0-58-3
704.- VP1000.-
";
1011;1011;1011;106;
101093;101093;101093;123;
I have all over the csv file these new lines. I need to make that in 1 line.
thank you for the help
If I understand the question correctly, you only wish to remove the newlines for any lines that do not end in a semicolon character. You can do that below with this Find and Replace in Notepad ++ using the Regular Expression Search Mode.
Find: ([^;]$)(\r\n)
Replace: \1
Explanation of the find is that it is looking for the end of line and newline character that isn't preceded by a semicolon character. The parenthesis tell the find to group the results, which allows us in the replace to just keep the first grouping of find results and to discard the newline characters for these lines that don't end in a semicolon, which will then end up making it all line up on the previous line.
Here is a simple solution:
Activate the ShowAll Icon (¶) in the toolbar of Notepad++
Mark a ; and NewLine-Sequence (CR LF) in your file
Use the shortcut Ctrl + F
Select the Replace tab in the appeared search window
Insert ; in the Replace with text box
Press Replace All
Now all items ending with a ; are in single rows.
To remove all new lines: Just replace "\r\n" (windows) or "\n" (unix) with nothing! Using Extended or Regex options.
To just remove some:
First add unique data where you want to keep the new line - I use "QAZ".
Then remove all new lines as above.
Then replace "QAZ" with "\n".
I am writing html files from a stack. This is a bit of a pain because for every line I have to write something like the following if the file contains quotes.
write "<div id=hidden-" & quote & myKanton & quote && "style=" & quote & "display:block;" "e&&"class=" "e & "popuptable" "e& ">" & LF to file tOutputFileCH
Now I have to add a lot of html code again and I'm wondering if there is an easier way to be able to do something like:
write escaped("my html numbers and "txt" with quotes") to file
I do not need variables within the html text.
Often, people use functions like
function q theText
replace "'" with quote in theText
return theText
end q
which can be used as
write q("<div id=hidden-'" & myKanton & "' style='display:block;'" & "class='popuptable'>" & LF) to file tOutputFileCH
You can use a string like in above example but you can also use any container:
get q(myVariable)
put q(it) into field 1
put q(field 1) into field 2
put q(url myUrl) into url myOtherUrl
put q(the cProperty of me) into myVar
-- etc etc etc
You can also use ´ or ` instead of ' if you change the q function.
By the way, I noticed that you don't include hidden- in the quotes. Are you sure that's correct?
HTML allows use of quotes and single quotes, so you can...
put "<div style='border:1px'>" into tHTML
LiveCode's format command allows you to escape double quotes...
put format("my html numbers and \"txt\" with quotes") into tData
It is working now. I put the html lines in a custom stack property and use that as input when writing the file. Works perfectly. It even seems to work without the q function.
write ( the cMapOverlay of stack "AfaConverter" ) & LF to file tOutputFileCH
I also tried that because
onmouseover="nhpup.popup($('#hidden-VS').html(), {'width': 400});" href="./kantone/index_kanton_VS.html"
this is trouble with q without adaptions because ' is replaced with " which is a problem.
There are some good answers here. Let me suggest another approach. You could use a quoting function, but in a slightly different way:
function q pString
return quote & pString & quote
end q
Then use the LiveCode merge() function. Merge evaluates any LiveCode expression or variable enclosed in [[ ]] and incorporates it into the enclosing quoted text:
write merge("my html numbers and [[q("txt")]]") to file
I created an Access 2013 report using a linked table from Sharepoint. In Sharepoint, the field is defined as "Multiple lines of text, Plain Text", in Access it comes down as "Long Text".
The field contents contains line breaks. In Access the field is "Can Grow=Yes" and "Text Format=Plain Text".
The problem is the report displays the field without the line breaks. Any ideas?
In Access I verified there are chr(10) characters but no chr(13) characters in the field. I tried replacing the chr(10) with chr(10) & chr(13) but that didn't work. It just seems to be ignoring the chr(10) character in the printed output.
I figured out a work around which is to use the 'Rich Text' report field property on the 'Plain Text' field:
Replace chr(10) with <br/> in the field on the report i.e.
=Replace([fieldname],Chr(10),"<br/>")
Change the text box 'Text Format' property from 'Plain Text' to 'Rich Text'
Dear people at Stackoverflow,
I would like to replace for every incoming e-mail the paragraph marks (^p i believe, at least in outlook Find & Replace) with manual line breaks (^l).
I've not been able to find a solution trough Google, but I might be searching wrong.
I am using the following code as a rule for every incoming e-mail:
(FYI this code works just fine with text)
Sub testing(MyMail As MailItem)
MyMail.HTMLBody = Replace(MyMail.HTMLBody, "example", "changedtext")
MyMail.Save
End Sub
Now I have tried to change the 2nd line to:
MyMail.HTMLBody = Replace(MyMail.HTMLBody, "^p", "^l")
And
MyMail.HTMLBody = Replace(MyMail.HTMLBody, "chr(13)", "chr(10)")
But these did not seem to work.
Unfortunately I'm not very familiar with VBA coding.
I've just been told I need to use chr() but I don't have a clue on how to do that.
Some background information:
I am using 2 rules, 1 to change every ^p with ^l and the other rule is to convert the email from HTML to plain text.
If I just convert it without first changing the ^p with ^l it will have all these extra empty lines.
Example:
Is someone out there that is willing to help me with this?
I would really appreciate it!
Regards,
Kris
There are several ways to do it, but all with the same side-effect.
If user SHIFT + ENTER 2 times, they will result in 1 new line also
Solution 1:
'Replace 2 newline into 1 newline
'vbCrLf is actually Chr(13) & Chr(10)
mail.HTMLBody = Replace(mail.HTMLBody, vbCrLf & vbCrLf, vbCrLf)
Solution 2:
'Replace any extra newline into ""
there will be an extra blank link at the very end
tmp = Split(mail.HTMLBody, vbCrLf)
For Each Line In tmp
If Line <> "" Then
newBody = newBody & Line & vbCrLf
End If
Next
mail.HTMLBody = newBody
How to remove More Than One Spaces In Between Words of contents in dreamweaver source view. when i copy any data from MS word and paste in Dreaweaver. dreamweaver shows many unneeded spaces in source code. which is showing also in html output like extra space betwwen word and extra space after "." fullstop.
Concerning regex tag you should be able replace " +" with " " (Both without quotes). That will destroy all subsequent spaces after first one.
Also you can search for "[ \t]+" instead of " +" in order to "eat" tab characters too.