Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #18720
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | "Tony" <tony.johansson@inport.com> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: can I rewrite this replace to use only one loop |
| Date | Tue, 5 Mar 2013 12:46:35 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 1 |
| Message-ID | <kh4ls9$64b$1@dont-email.me> (permalink) |
| References | <kh4lbt$3bg$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; format=flowed; charset="iso-8859-1"; reply-type=response |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Tue, 5 Mar 2013 11:45:13 +0000 (UTC) |
| Injection-Info | mx05.eternal-september.org; posting-host="04290fff4557273ca84c3ad616751e0b"; logging-data="6283"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/rqfQNsz+Agj1yn3qEFNxHk6lQh4NdWv8=" |
| X-MimeOLE | Produced By Microsoft MimeOLE V15.4.3555.308 |
| In-Reply-To | <kh4lbt$3bg$1@dont-email.me> |
| X-Newsreader | Microsoft Windows Live Mail 15.4.3555.308 |
| Importance | Normal |
| Cancel-Lock | sha1:JSNtWBBpCL6f7jV/uessGhPc0Dk= |
| X-Priority | 3 |
| X-MSMail-Priority | Normal |
| Xref | csiph.com comp.lang.javascript:18720 |
Show key headers only | View raw
I found it myself
var bytUt1 = /-/g;
var bytUt2 = /T/g;
for (i = 0; i < tempArray.length; i++)
{
tempArray[i].ETATime = tempArray[i].ETATime.replace(bytUt1,
"/");
tempArray[i].ETATime = tempArray[i].ETATime.replace(bytUt2,
" ");
}
//Tony
"Tony" wrote in message news:kh4lbt$3bg$1@dont-email.me...
In this for loop I loop through the array and replace - with /
var bytUt = /-/g;
for (i = 0; i < tempArray.length; i++)
{
tempArray[i].ETATime = tempArray[i].ETATime.replace(bytUt,
"/");
}
In this for loop I loop through the array and replace T with " "
var bytUt = /T/g;
for (i = 0; i < tempArray.length; i++)
{
tempArray[i].ETATime = tempArray[i].ETATime.replace(bytUt, "
");
}
This works but can I replace this to a single for loop ?
//Tony
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
can I rewrite this replace to use only one loop "Tony" <tony.johansson@inport.com> - 2013-03-05 12:37 +0100 Re: can I rewrite this replace to use only one loop "Tony" <tony.johansson@inport.com> - 2013-03-05 12:46 +0100 Re: can I rewrite this replace to use only one loop SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2013-03-05 14:31 +0100
csiph-web