string help!

grizzlyjdw2

Registered User.
Local time
Today, 09:09
Joined
Feb 26, 2009
Messages
22
ok, here is what i am up against:

i am reading in a txt file into a string. so for example i get the following

abc
def

now i am searching through the text for def, which works fine, but i am putting in error handling cases (ie if network is a word and i am searching for work, it should not return a positive)

anyway, the return after the word i can detect and work with. however the return in front of the word i can not seem to detect.

if i check the character before d for a return i don't get a positive, if i check the character after c i get a return. how is that possible?

for the return character i am using chr$(13)

any help would be appriciated
 
As the next row is now on a new row, there is no carriage return or line feed. They live on the line previous. So, what are you using this for? There may be other things that can be done. How are you getting this information to the string variable?
 
i found out what it was doing. it was reading in 2 characters for the return into the string.

for example if the text file contained:

abc
def

the string would contain 8 characters. the actual return started on the first of the 2 characters between the abc and def. i was checking the position of def - 1 and i should have been checking def - 2. i guess the return is 2 bytes? or is there another character between the return and def?
 
Normally you would have both a Carriage Return - Chr(13) and a Line Feed - Chr(10)
 
cool, i was wondering about the second character, ill have to do a check (just for my own personal curiosity) to see about the line feed.

im use to c++, so playing with strings in vba seems a lot different to me. i'm getting there though :)
 

Users who are viewing this thread

Back
Top Bottom