  | | | Trim | Trim 2004-03-13 - By Nathan Derksen
Back Try something like:
my_str = new String( outputArray ); _global.listResult += my_str.slice(0, 50);
The slice method doesn't do anything on the source string, it returns a sliced version of the string.
Also, the "new String" is redundant. my_str = outputArray will do the same thing, since outputArray is already a string.
Nathan http://www.nathanderksen.com
On Mar 13, 2004, at 5:40 PM, Simon Lord wrote:
> Thanks Jayson. I poked at it and I'm a little stumped. The example > in the manual works fine, the trace output exactly what I wanted. So > I applied it to my code and it's being completely ignored. I've been > staring at it for 20 mins now and don't see anything wrong, it should > work. > > <snip> > > var z = 0; > var outputArray = new Array(); > // > while (z<userList.length) { > outputArray = > userList[z]+".......................................................... > .."+"\n"; > // This is where I was hoping to trim the string to a specific length > my_str = new String( outputArray ); > my_str.slice( 0, 50 ); > // > _global.listResult += my_str; > z++; > } > > </snip> > > ... There is no difference between the results I get from this code > and my prior code which did not attempt to "slice* the string. I can > even set it to drop the first 10 characters in my string but it gets > ignored. So: > > my_str.slice( 10, 50 ); > > ... has no affect on the output. Something is obviously wrong with > the code, having it work from the sample but not in my "do while" is > putting a damper on my evening. > > Help?
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Supported by Fig Leaf Software =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Be sure to check the archives and the wiki: http://chattyfig.figleaf.com/ =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:106856 =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe send a blank e-mail to: Normal Mode: flashcoders-unsubscribe@(protected) Digest Mode: flashcoders-digest-unsubscrive@(protected)
|
|
 |