Click here to Skip to main content
15,896,063 members
Home / Discussions / C#
   

C#

 
AnswerRe: Text.Length Command Pin
asquaredtech9-Jan-09 11:25
asquaredtech9-Jan-09 11:25 
GeneralRe: Text.Length Command Pin
Henry Minute9-Jan-09 11:33
Henry Minute9-Jan-09 11:33 
GeneralRe: Text.Length Command Pin
Colin Angus Mackay9-Jan-09 13:35
Colin Angus Mackay9-Jan-09 13:35 
GeneralRe: Text.Length Command Pin
Guffa9-Jan-09 17:24
Guffa9-Jan-09 17:24 
GeneralRe: Text.Length Command Pin
Henry Minute9-Jan-09 23:34
Henry Minute9-Jan-09 23:34 
GeneralOMG Pin
Luc Pattyn9-Jan-09 11:40
sitebuilderLuc Pattyn9-Jan-09 11:40 
GeneralRe: Text.Length Command Pin
Henry Minute9-Jan-09 12:22
Henry Minute9-Jan-09 12:22 
GeneralRe: Text.Length Command Pin
Colin Angus Mackay9-Jan-09 13:44
Colin Angus Mackay9-Jan-09 13:44 
asquaredtech wrote:
It was well understood before this was posted that the "\r\n" is an escape sequence and the "\r" is compiled as one character.


Then why do you insist on wanting to know the index position of something that does not exist.


asquaredtech wrote:
My question is why the the index of the string counts the "\"s and the length does not.


It doesn't. They both operate on the same sequence of characters.

Okay, here:

string s = "Hello\r\nWorld"
 
s.Length == 12
 
s[0]=='H'
s[1]=='e'
s[2]=='l'
s[3]=='l'
s[4]=='o'
s[5]==the return character
s[6]==the newline character
s[7]=='W'
s[8]=='o'
s[9]=='r'
s[10]=='l'
s[11]=='d'


As you can see, there are 12 indexes and the string length is 12. They are the same. The indexes start at 0 (as they always do in C#)

asquaredtech wrote:
All I want to do is overwrite an existing string of text with a new string of text. I have it working other than the fact that the string counts the "\"s when referring to the index of the string.


Gosh! Then lets look at your actual problem rather than go around in circles about string lengths and indexes.

* Developer Day Scotland 2 - Free community conference
* The Blog of Colin Angus Mackay


Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.

GeneralRe: Text.Length Command Pin
asquaredtech9-Jan-09 19:13
asquaredtech9-Jan-09 19:13 
GeneralRe: Text.Length Command Pin
Guffa10-Jan-09 0:52
Guffa10-Jan-09 0:52 
AnswerRe: Text.Length Command Pin
Guffa9-Jan-09 17:34
Guffa9-Jan-09 17:34 
GeneralRe: Text.Length Command Pin
asquaredtech9-Jan-09 19:20
asquaredtech9-Jan-09 19:20 
GeneralRe: Text.Length Command Pin
Guffa9-Jan-09 20:10
Guffa9-Jan-09 20:10 
QuestionMultiple values in a querystring Pin
ferronrsmith9-Jan-09 8:48
ferronrsmith9-Jan-09 8:48 
AnswerRe: Multiple values in a querystring Pin
sudhanvag10-Jan-09 5:18
sudhanvag10-Jan-09 5:18 
GeneralRe: Multiple values in a querystring Pin
ferronrsmith10-Jan-09 9:55
ferronrsmith10-Jan-09 9:55 
GeneralRe: Multiple values in a querystring Pin
sudhanvag10-Jan-09 15:59
sudhanvag10-Jan-09 15:59 
QuestionRead and copy .docx Pin
Xtrme_XJ9-Jan-09 8:23
Xtrme_XJ9-Jan-09 8:23 
Questionunisgned integers and global cases in C# Pin
Xarzu9-Jan-09 7:54
Xarzu9-Jan-09 7:54 
AnswerRe: unisgned integers and global cases in C# Pin
Eddy Vluggen9-Jan-09 8:24
professionalEddy Vluggen9-Jan-09 8:24 
AnswerRe: unisgned integers and global cases in C# Pin
JByrd20069-Jan-09 9:02
JByrd20069-Jan-09 9:02 
AnswerRe: unisgned integers and global cases in C# Pin
Guffa9-Jan-09 17:52
Guffa9-Jan-09 17:52 
Questionany body idea in viterbi algorithm Pin
lawrenceinba9-Jan-09 7:39
lawrenceinba9-Jan-09 7:39 
AnswerRe: any body idea in viterbi algorithm Pin
Christian Graus9-Jan-09 7:46
protectorChristian Graus9-Jan-09 7:46 
GeneralRe: any body idea in viterbi algorithm Pin
lawrenceinba9-Jan-09 8:00
lawrenceinba9-Jan-09 8:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.