473,378 Members | 1,391 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 4538
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.