Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.lang.javascript > #8103

Re: Problema script [restart thread] - Risolto -

From Lino <lino@net.com>
Newsgroups it.comp.lang.c++, it.comp.lang.javascript, microsoft.public.it.office.excel
Subject Re: Problema script [restart thread] - Risolto -
Date 2016-11-24 14:10 +0100
Organization Aioe.org NNTP Server
Message-ID <mn.c3527e0bb0d94ed7.142705@net.com> (permalink)
References <mn.bd797e0b5a0b24cc.142705@Kiss-the-Sphinx>

Cross-posted to 3 groups.

Show all headers | View raw


Sembra che Lino abbia detto :
> il thread parte da qua (correggendo lo script in varie parti) prima ho 
> fatto un po di confusione a scrivere
> ----------------------------------------------------------
> La domanda originaia era:

> Io avrei un database (in un software) di tanti simboli e lo script sopra da 
> in modo di cambiare gli ultimi caratteri[A DESTRA] di un dato testo.

> Se volessi invece cambiarlo e fare in modo di cambiare i >>PRIMI<< (a 
> sinistra) come potrei modificare lo script?

> Lo script con la parte modificata:
> [prima era :  st.Ticker = StrLeft( ticker, Length-3)+"-TC";]

> Script
> -------------------------------------------
> AB = CreateObject("Broker.Application");
> sts = AB.Stocks();
> Qty = sts.Count;

> for( i = Qty - 1; i >= 0; i = i - 1 )
> {
>  st = sts.Item( i );
>  Ticker = st.Ticker;
>  printf("changing " + Ticker + "\n" );
>  Length = StrLen(Ticker );
>  if( StrFind(Ticker, ".TO") )

>   st.Ticker= "TO:"+StrRight(Ticker,Lenght+3);
> }
> ------------------------------------------------

> Lo script funziona parzialmente ma ci sono 2 problemi:

> (1.) cambia solo 1 simbolo alla vota (forse per un problema del ciclo FOR)

> (2.) Errore più grave:

> Esempio: Io ho i simboli [sotto] -----> e il risultato dato dallo script

> TO:A       TC-T:A  wrong
> TO:DE      TC-:DE  wrong
> TO:ASD     TC-ASD  OK OK OK OK
> TO:AXMA    TC-XMA  Wrong
> TO:ERJTT   TC-JTT  wrong
> ...
> ...
> etc..

> Io voglio modificare solo la parte che voglio (in questo caso "TO:") 
> lasciando la parte rimamente così come era originariamente.

> spero di essere stato chiaro.
> Grazie per l'eventuale aiuto.
> Lino.

Risolto:

AB = CreateObject("Broker.Application");
sts = AB.Stocks();
Qty = sts.Count;


for( i = Qty - 1; i >= 0; i = i - 1 )
{
 st = sts.Item( i );
 Ticker = st.Ticker;
 printf("changing " + Ticker + "\n" );
 Length = StrLen(Ticker );

 if( StrFind(Ticker, "BIT:") )

   st.Ticker= StrReplace(st.Ticker, "BIT:", "IT_");
}

Back to it.comp.lang.javascript | Previous | NextPrevious in thread | Find similar


Thread

Problema script [restart thread] Lino <lino@net.com> - 2016-11-23 23:21 +0100
  Re: Problema script [restart thread] - Risolto - Lino <lino@net.com> - 2016-11-24 14:10 +0100

csiph-web