Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Ok, I'm trying to parse text in a rtf.text, and there are cr/lf's. when I get the .indexof(my) something like this:

 

 

hello cr/lf

cr/lf

my name is

 

it will return a value of 7, EXCLUDING the cr/lf's!

 

How do i get the absolute index of instead of the bumped-down version that skew's the index? PLEASE HELP frustrating!!!!

www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
  • *Experts*
Posted

Actually, you're not getting CR/LF, just CR (or LF, I can't remember my ASCII codes). Remember that IndexOf is 0 based.

h=0

e=1

l=2

l=3

o=4

CR=5

CR=6

m=7

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
  • *Experts*
Posted

I'm not sure what you're saying. Did you read my post? Does it make sense? The IndexOf does include the position of the CR characters. When you use a RichTextbox and press enter, it doesn't store the LF - only the CR. And IndexOf DOES see those characters.

 

What do you mean by "how do I deal with this" and "get the absolute location of a specific string of text"? I'd have to answer IndexOf...

 

-nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

I actually figured out what was going on. I was taking the strings from a memo field in MSaccess. In MSaccess, I would type the memo text in, and use <ctrl-enter> as cr/lf. This must be translating differently - because it was causing the indexof command askew.

 

My fix:

 

I created a new application that used a text box, and wrote the contents of the text box to the memo field. this way i read the contents of memo field and indexof command worked as it should.

 

 

 

I suppose I didnt word the question correctly, I apologize.

www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...