Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-17-2002, 12:14 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default [quote]Hmm.. Can't get enough of that stream objec

Scopas says:


Quote:

I'm extracting some data from a file.. I think I'm catching a carriage return of some kind because if I trace the result with the following - trace(stringRead +"XX") - then I get the right result but I never see the XX..

The problem is that I will never be able to concatenate the stringRead with anything..

Do you now what is wrong? If it is a carriage return of some kind can I then replace it?

It sure plays my mind a trick..

/Scopas
Reply With Quote
  #2 (permalink)  
Old 12-17-2002, 12:15 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: [quote]Hmm.. Can't get enough of that stream o

Scopas says:

Quote:

I have checked it a bit further by first splitting the stringRead by " " and after that splitting the last post in the array with ""..

I don't think there's a carriage return but I think that the places after the text is just empty spaces "00" in the file..

So do anyone have any idea on how to handle that?

/Scopas

Reply With Quote
  #3 (permalink)  
Old 12-17-2002, 12:15 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: [quote]Hmm.. Can't get enough of that stream o

You can get the length of the string to determine what is there on earth. string.length

The length includes the carriage returns and zeros.
Reply With Quote
  #4 (permalink)  
Old 12-17-2002, 12:16 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: [quote]Hmm.. Can't get enough of that stream o

Scopas says:


Quote:

Yeah... Heh.. did figure that one out..

The problem is that the zeroes somehow does so that the string ends there..

ex:

I take out a chunk of a file with stringRead = stream.read(30);

the stringRead now contains "Jesper" and the last 24 characters is zeroes..

If I want to add "Hansen" after stringRead then I can't because it seems that the trailing zeroes end the string..

I can do like this "Hansen "+ stringRead;
But not this stringRead +" Hansen";

Then one would say offcourse you can but Hansen will just be 24 spaces away from Jesper but that's not the case either.. It simply terminates the string one is about to build..

/Scopas
Reply With Quote
  #5 (permalink)  
Old 12-17-2002, 12:17 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: [quote]Hmm.. Can't get enough of that stream o

Scopas says:


Quote:
I found a way out of this by doing a regexp like this:

Code:
r = /[ \w]+/gi;
trace(r.exec(stringRead) +"XX");

It works allright..

/Scopas



Reply With Quote
  #6 (permalink)  
Old 12-17-2002, 12:18 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: [quote]Hmm.. Can't get enough of that stream o

Scopas says:


Quote:
Heh you think you're out of the woods..

If I want to regexp 2 seperate strings like this:
Code:
r = /[ \w]+/gi;
k = /[ \w]+/gi;
s = "ab bdabbc abdaBa";
p = "abbd abbcab daBaryjry";
trace(r.exec(s));
trace(k.exec(p));
Then it fucks up.. I can't really see what happens or why it should be a problem.. Anyone?

/Scopas



Reply With Quote
  #7 (permalink)  
Old 12-17-2002, 12:19 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: [quote]Hmm.. Can't get enough of that stream o

When you use the global flag 'g', the "lastIndex" property is changed. It's a global property that specifies the position at which to start the next match.

You can do like this:

Code:
r = /[ \w]+/i;
k = /[ \w]+/i;
s = "ab bdabbc abdaBa";
p = "abbd abbcab daBaryjry";
trace(r.exec(s));
trace(k.exec(p));
or:

Code:
r = /[ \w]+/gi;
k = /[ \w]+/gi;
s = "ab bdabbc abdaBa";
p = "abbd abbcab daBaryjry";
trace(r.exec(s));
k.lastIndex = 0;
trace(k.exec(p));
Reply With Quote
  #8 (permalink)  
Old 12-17-2002, 12:20 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: [quote]Hmm.. Can't get enough of that stream o

Scopas says:

Quote:

Ahh thanks...

I've never been good at those regExp's not even in Qjavascript .. But one's learning on the way..

Thanks..

/Scopas


Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 01:59 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.