472,958 Members | 2,001 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Help with end-of-line string characters

I have this following code:

x= tempStr.IndexOf((char)13, 0);

The string tempSTR = "
Heading"

Notice that their is a Carriage Return and/or line feed before the
stirng value of "heading?" What I was wanting to do with this code is
for the variable x to equal to location of the first carriage
return/line feed/new line caracter (ASCII 13 or 10 values). But it
seems that when I run this the value of x= 9 instead of 1 why is this?

Bascially I am porting a VBA program into a C# program for a word
automation application I wrote. In VBA this is what I had for this
function:

x = InStr(1, tempStr, chr(13))

In VBA x = 1 not 9. Does anyone know of a whay to make the c#
expression equal 1 instead of 9?

Feb 9 '06 #1
3 4520
mr********@gmail.com wrote:
I have this following code:

x= tempStr.IndexOf((char)13, 0);

The string tempSTR = "
Heading"

Notice that their is a Carriage Return and/or line feed before the
stirng value of "heading?" What I was wanting to do with this code is
for the variable x to equal to location of the first carriage
return/line feed/new line caracter (ASCII 13 or 10 values). But it
seems that when I run this the value of x= 9 instead of 1 why is this?

Bascially I am porting a VBA program into a C# program for a word
automation application I wrote. In VBA this is what I had for this
function:

x = InStr(1, tempStr, chr(13))

In VBA x = 1 not 9. Does anyone know of a whay to make the c#
expression equal 1 instead of 9?


Why are you asking this in comp.lang.*c*?
--
==============
*Not a pedant*
==============
Feb 9 '06 #2
mr********@gmail.com wrote:

I have this following code:

x= tempStr.IndexOf((char)13, 0);

The string tempSTR = "
Heading"

Notice that their is a Carriage Return and/or line feed before the
stirng value of "heading?" What I was wanting to do with this code is
for the variable x to equal to location of the first carriage
return/line feed/new line caracter (ASCII 13 or 10 values). But it
seems that when I run this the value of x= 9 instead of 1 why is this?


/* BEGIN new.c */

#include <stdio.h>
#include <string.h>

int main(void)
{
char *tempSTR = "\nHeading";
char *ptr;

ptr = strchr(tempSTR, '\n');
if (ptr != NULL) {
printf("\ntempSTR[%d] is a newline character.\n",
(int)(ptr - tempSTR));
}
return 0;
}

/* END new.c */
--
pete
Feb 9 '06 #3
In article <11**********************@g47g2000cwa.googlegroups .com>,
<mr********@gmail.com> wrote:
I have this following code:

x= tempStr.IndexOf((char)13, 0);

The string tempSTR = "
Heading"

Notice that their is a Carriage Return and/or line feed before the
stirng value of "heading?" What I was wanting to do with this code is
for the variable x to equal to location of the first carriage
return/line feed/new line caracter (ASCII 13 or 10 values). But it
seems that when I run this the value of x= 9 instead of 1 why is this?

Bascially I am porting a VBA program into a C# program for a word
automation application I wrote. In VBA this is what I had for this
function:


Allow me to be the first to say this - and I say it from the deepness of my
heart, with all the kindness and love one has come to associate with the
helpful posts you get in this newsgroup:

Not portable. Can't discuss it here. Blah, blah, blah.

Feb 13 '06 #4

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

Similar topics

6
by: Virginia Kirkendall | last post by:
Hi: I'm new with this & need help creating a XSL table that looks like the following: --------------------------------------------------------- | | | | | |...
1
by: Mike | last post by:
Hey guys I need some help with updateing an access database. I used OleDB controls to set up my connection, adapter, and dataset. The access table I am trying to update has these columns in this...
13
by: Chua Wen Ching | last post by:
Hi there, I saw this article here in vb.net. http://www.error-bank.com/microsoft.public.dotnet.languages.vb.1/148992_Thread.aspx and ...
3
by: Marek | last post by:
Hello gurus! I wrote a code in VBS, that will check, that current user is in one from three groups. But i don't know how asimilate it with asp.net. This page will be a bridge between 2 - main...
8
by: Alison | last post by:
Hi, Al I am trying to design a user interface which provides both menus and toolbars for some users to click on whatever they want to do, at the same time, I would like to have a console window...
1
by: ucasesoftware | last post by:
I have just a problem to margin the Datagrid... Could someone help me ? the datragid always print in the top LEFT #Region " Impression " 'Déclaration Private PrintPageSettings As New...
1
by: mmuralha | last post by:
Hi, fellows, I wish to do a prodedure to actualize the vehicle's venal value, when I update the date. As I did, because there are 5 classes, the procedure stay very large and crash. If...
17
by: Riaaaa | last post by:
Pls check my code for the stored procedure which i created for the companydetails including companyid P.K. Not Null int(4), companyname Not Null varchar (20), address varchar(30) where...
13
by: Apostle | last post by:
Hi all, after thinking for sometimes, I thought it will be great opportunity to learn if I will start from scratch and build my own register/login system. Here is the thread that I will be posting...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.