473,597 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Newline in Text Property

Hi,

I would like to be able to embed a newline in a text string.
Is there any convienent notation to do this

TIA Steve
Nov 20 '05 #1
29 3434
Hi RunningDog,

You mean something as (not tested only typed in here)
\\\
dim newstring as new system.text.str ingbuilder(myst ring.substring( 0,10))
newstring.appen d(vbcrlf)
newstring.appen d(mystring.subs tring(10))
mystring = newstring.toStr ing
///

I hope this helps?

Cor
Nov 20 '05 #2
Hi RunningDog:
"runningdog " <ru********@rep ly.to.newsgroup > wrote in message
news:40******** *************** @lon-reader.news.tel stra.net...
Hi,

I would like to be able to embed a newline in a text string.
Is there any convienent notation to do this

TIA Steve

Try either Environment.New Line (for a truly .NET language independent
approach) or ControlChars.Cr Lf
Nov 20 '05 #3
Hi Bill,
Try either Environment.New Line (for a truly .NET language independent
approach) or ControlChars.Cr Lf


What do you mean with the sentence ".Net language independent". When you are
using VB.net you are using a .Net language, what has that to do with
language independent?

Cor
Nov 20 '05 #4
On 2004-04-20, Cor Ligthert <no**********@p lanet.nl> wrote:
Hi Bill,
Try either Environment.New Line (for a truly .NET language independent
approach) or ControlChars.Cr Lf


What do you mean with the sentence ".Net language independent". When you are
using VB.net you are using a .Net language, what has that to do with
language independent?

Cor


It's more of a platform specific rather then a "language independent"
thing... For example - on Linux and Unix systems the new line character
is a LF rather then a CRLF. By using System.Environm ent.NewLine rather
then ControlChars.Cr LF you can write code that will be portable if you
ever have to run it on a *nix environment, such as mono.

--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
Ninety percent of everything is crap.
-- Theodore Sturgeon
Nov 20 '05 #5
Hi Tom,

Much to late for you and Bill, and I expected another answer from Bill? When
I wrote it I was also thinking about you (that is for me equivalent to mono)
however I did want to avoid that in my question. Maybe you see that now in
my text.

Pitty although I knew that this answer could come from you it and it was
happening.

:-))))

Cor
It's more of a platform specific rather then a "language independent"
thing... For example - on Linux and Unix systems the new line character
is a LF rather then a CRLF. By using System.Environm ent.NewLine rather
then ControlChars.Cr LF you can write code that will be portable if you
ever have to run it on a *nix environment, such as mono.

Nov 20 '05 #6
* Tom Shelton <to*@mtogden.co m> scripsit:
It's more of a platform specific rather then a "language independent"
thing... For example - on Linux and Unix systems the new line character
is a LF rather then a CRLF. By using System.Environm ent.NewLine rather
then ControlChars.Cr LF you can write code that will be portable if you
ever have to run it on a *nix environment, such as mono.


Where did you read that?

There is a contradiction in the documentation for 'Environment.Ne wLine':

<msdn>
Gets the newline string defined for this environment.
[...]
Property Value
A string containing "\r\n".
</msdn>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #7
* "runningdog " <ru********@rep ly.to.newsgroup > scripsit:
I would like to be able to embed a newline in a text string.
Is there any convienent notation to do this


'ControlChars.N ewLine', 'Environment.Ne wLine', 'vbNewLine'.

\\\
MsgBox(String.F ormat("Foo{0}Ba r{0}Baz{0}", ControlChars.Ne wLine))
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #8
Thanks for the responces.
I was looking for something along the lines of the inline substitution
provide by Unix scripting languaages and some C libraries.

eg .
\b Backspace
\c Prints line without newline
\f Form feed
\n Newline
\r Carriage return
\t Tab
\v Vertical tab
\\ Backslash
\n The 8-bit character

echo "some text\n\n\nmore text ?\c"
some text
more text ?_

Steve

"runningdog " <ru********@rep ly.to.newsgroup > wrote in message
news:40******** *************** @lon-reader.news.tel stra.net...
Hi,

I would like to be able to embed a newline in a text string.
Is there any convienent notation to do this

TIA Steve

Nov 20 '05 #9
In article <c6************ @ID-208219.news.uni-berlin.de>, Herfried K. Wagner [MVP] wrote:
* Tom Shelton <to*@mtogden.co m> scripsit:
It's more of a platform specific rather then a "language independent"
thing... For example - on Linux and Unix systems the new line character
is a LF rather then a CRLF. By using System.Environm ent.NewLine rather
then ControlChars.Cr LF you can write code that will be portable if you
ever have to run it on a *nix environment, such as mono.


Where did you read that?

There is a contradiction in the documentation for 'Environment.Ne wLine':

<msdn>
Gets the newline string defined for this environment.
[...]
Property Value
A string containing "\r\n".
</msdn>


That's because MS.NET only runs on Windows :) Look in the Remarks
section:

The property value is a constant customized specifically for the
current platform.

When running code on Linux under mono, Environment.New Line returns a
character of value 10 - an LF :)

--
Tom Shelton [MVP]
Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5796
by: Quan Nguyen | last post by:
StreamWriter sw = new StreamWriter(strFileName, false, encoding); sw.NewLine = "\r\n"; sw.Write(txtbox.Text); sw.Close(); In the code snippet above, I tried to save the content of a RichTextBox as a plain text file; however, the result file would have "\n" as its line terminators instead of Windows default "\r\n". (Window Notepad would show the
5
12129
by: Kaka | last post by:
Hi, I am a learner for C# and .Net. I want to know how to put a line break to a string so that when it show in the textbox the text will be displayed in saperated lines. e.g.: String s; s = "AAAAAAAAAAAAAAAAAAAAA"; s += "BBBBBBBBBBBBBBBBBBBBBBB";
10
11623
by: D Steward | last post by:
I can't seem to add a newline (/n) to get a richtextbox control to display text on successive lines. The text that I type is overwritten. How do I remedy this My example richTextBox->Multiline = true richTextBox->Text = S"First line /n" richTextBox->Text = S"Second line" Thanks
7
8352
by: Alex Nordhus | last post by:
I am looking for a way to strip the blank line and the empty newline at the end of the text file. I can get the blank lines removed from the file but it always leaves the end line (which is blank) as a newline. My code is here and it works but leaves the newline at the end of the file. How do I get rid of it? import re f = open("oldfile.txt") w = open("newfile.txt", "wt") for line in f.readlines():
4
4470
by: Peter Kirk | last post by:
Hi I would like to ask a little bit about the value Environment.Newline: what is it and what is the point of it? Ok, I can see in the docs that it represents "newline" for the current platform - I assume that it is a runtime property, and not compile time? But won't it always be the same anyway - does dotnet run on anything other than windows platforms? So isn't newline always the same?
5
6982
by: Adam Right | last post by:
Hi, Is there a way to construct the mail body including newline characters by using .net framework mailing functions when sending an email? I cannot insert newline character into the body of the mail. Thanks...
16
38598
by: junky_fellow | last post by:
Is there any efficcient way of removing the newline character from the buffer read by fgets() ? Is there any library function that is similar to fgets() but also tells how many bytes it read into the buffer ?
11
24881
by: Michael | last post by:
I'm new to PHP. I see that PHP supports the C printf function, and I've seen examples like printf("Hello world!\n"); however the newline character \n doesn't work - i.e., it does not generate an HTML <br>, which I would have expected - what it does is generate a newline in the html generated text, but since the browser ignores blank lines, this feature appears useless for most applications.
0
1533
by: Peter Donis | last post by:
When running a doctest text file with doctest.testfile, I noticed that universal newline support did not appear to work when module_relative is False. My text file was saved on a Windows machine but I was testing it on a Linux machine, hence the newline mismatch (doctest would throw a SyntaxError for every incorrect newline). I looked at the svn trunk history for doctest.py and found the following patch: ...
0
7981
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8284
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8392
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8262
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3894
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
1245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.