473,466 Members | 1,508 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

string question

J
Hi, I have a simple string question in C#:

a VB.NET statement like this:
sb.Append(Chr(34) & myReader.GetValue(i).ToString & Chr(34) & vbCrLf)

So, for Chr(34) and vbCrLf, what I need to use in C#?

Thanks all.
J.
Nov 16 '05 #1
3 2997
Hi,

I assume that sb is a StringBuilder instance:
sb.Append( (char)34 );
sb.Append( myReader.GetValue(i) );
sb.Append( (char)34 );
sb.Append( "\n" );

Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"J" <j@NoSpam.org> wrote in message
news:ao********************************@4ax.com...
Hi, I have a simple string question in C#:

a VB.NET statement like this:
sb.Append(Chr(34) & myReader.GetValue(i).ToString & Chr(34) & vbCrLf)

So, for Chr(34) and vbCrLf, what I need to use in C#?

Thanks all.
J.

Nov 16 '05 #2
Hi J,

Just to add to Ignacio's reply, you might want to use \r\n instead of just \n as \n is just the newline character without the return (usually enought, but maybe not always).

Alternately you can use Environment.NewLine which is system independent and will produce \r\n or the equivalent on your current system.

--
Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #3
Also, note the Chr(34) is the same as '\"' (that's single-quote,
back-slash, double-quote, single-quote)

You could also write that as:

sb.AppendFormat("\"{0}\"\r\n", myReader.GetValue(i));

--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!)
"J" <j@NoSpam.org> wrote in message
news:ao********************************@4ax.com...
Hi, I have a simple string question in C#:

a VB.NET statement like this:
sb.Append(Chr(34) & myReader.GetValue(i).ToString & Chr(34) & vbCrLf)

So, for Chr(34) and vbCrLf, what I need to use in C#?

Thanks all.
J.

Nov 16 '05 #4

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

Similar topics

2
by: sparks | last post by:
I know this is a stupid question but I can't find the answer. Please tell me where to find reference to this so I can print it out and staple it to my head.. dim I as integer dim missedstr as...
5
by: John Baro | last post by:
I have a richtextbox which I want the "literal" rtf of. richtextbox.rtf returns {\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033\\uc1 }\r\n\0 when i put this into a string I get...
5
by: Dave | last post by:
I'm receiving info from a com port into a string. I gradually process the string which constantly shortens it. The question is how long can a string be before I need to write some info to disk...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
2
by: Dan Schumm | last post by:
I'm relatively new to regular expressions and was looking for some help on a problem that I need to solve. Basically, given an HTML string, I need to highlight certain words within the text of the...
11
by: Zordiac | last post by:
How do I dynamically populate a string array? I hope there is something obvious that I'm missing here Option Strict On dim s() as string dim sTmp as string = "test" dim i as integer ...
53
by: Jeff | last post by:
In the function below, can size ever be 0 (zero)? char *clc_strdup(const char * CLC_RESTRICT s) { size_t size; char *p; clc_assert_not_null(clc_strdup, s); size = strlen(s) + 1;
6
by: tommaso.gastaldi | last post by:
Hi, does anybody know a speedy analog of IsNumeric() to check for strings/chars. I would like to check if an Object can be treated as a string before using a Cstr(), clearly avoiding the time...
39
by: sucaba.r | last post by:
I don't know if this is a unique problem, or I'm going about it the wrong way. I currently connect to one of our SQL servers via a priviliged account (by using RUNAS). Works with no problem. I...
7
by: Sky | last post by:
I have been looking for a more powerful version of GetType(string) that will find the Type no matter what, and will work even if only supplied "{TypeName}", not the full "{TypeName},{AssemblyName}"...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.