How to split a sting with comma and put into an array - EasyLanguage Programming | futures io social trading
futures io futures trading


How to split a sting with comma and put into an array
Updated: Views / Replies:394 / 9
Created: by huzisg Attachments:0

Welcome to futures io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.


You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Reply
 
Thread Tools Search this Thread
 

How to split a sting with comma and put into an array

  #1 (permalink)
Trading Apprentice
HANGZHOU,ZHEJIANG,CHINA
 
Futures Experience: Advanced
Platform: Multicharts
Favorite Futures: MC
 
Posts: 5 since Aug 2016
Thanks: 0 given, 0 received

How to split a sting with comma and put into an array

HI, does anyone know how to split a string with comma to an array?

e.g.

str = "111,222,333,444,555"

arr[0] = "111";
arr[1] = "222";
...

thanks!

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,328 since Apr 2013
Thanks: 212 given, 755 received


huzisg,

you should be able to accomplish that with using a while loop and the reserved words for string manipulation i.e.
LeftStr, RightStr, MidStr and InStr is what you can utilize here.
With these you can step through your string from comma to comma.

1. Have your loop check that there are still letters in your test string.
2. Take everything to the left of the first comma and store it in the array.
3. If there is no comma in the string, store the string in the array and set the test string to an empty string (so your loop can be exited).
4. Modify your test string so it now contains only the string to the right of the first comma.
5. You loop will repeat steps 2. to 4. until there is no new comma.

This should give you what you are looking for, but it will involve a bit of programming.

Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #4 (permalink)
Trading Apprentice
HANGZHOU,ZHEJIANG,CHINA
 
Futures Experience: Advanced
Platform: Multicharts
Favorite Futures: MC
 
Posts: 5 since Aug 2016
Thanks: 0 given, 0 received

So I known that there is no a function like "split" in vb, thanks for you reply.

Reply With Quote
 
  #5 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,328 since Apr 2013
Thanks: 212 given, 755 received

No, unfortunately there isn't, but you should be able to easily accomplish what you have in mind following the four simple steps I described.

Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #6 (permalink)
Trading Apprentice
Onsala Sweden
 
Futures Experience: Intermediate
Platform: Multichart
Broker/Data: InteractiveBrokers, eSignal
Favorite Futures: OMXS30
 
Posts: 28 since Nov 2016
Thanks: 21 given, 1 received


ABCTG View Post
huzisg,

you should be able to accomplish that with using a while loop and the reserved words for string manipulation i.e.
LeftStr, RightStr, MidStr and InStr is what you can utilize here.
With these you can step through your string from comma to comma.

1. Have your loop check that there are still letters in your test string.
2. Take everything to the left of the first comma and store it in the array.
3. If there is no comma in the string, store the string in the array and set the test string to an empty string (so your loop can be exited).
4. Modify your test string so it now contains only the string to the right of the first comma.
5. You loop will repeat steps 2. to 4. until there is no new comma.

This should give you what you are looking for, but it will involve a bit of programming.

Regards,

ABCTG

Hi,

How do you modify the test string? Is there any "SubStr" function or function which can return the length of a string?

Best regards
Shahram

Reply With Quote
 
  #7 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,328 since Apr 2013
Thanks: 212 given, 755 received

Shahram,

yes, there are. You can find them documented here: https://www.multicharts.com/trading-software/index.php/Category:Text_Manipulation including examples.

 
Code
StrLen( "My String" ) ;
The code above would for example return the length of this string.

Regards,

ABCTG

Reply With Quote
The following 2 users say Thank You to ABCTG for this post:
 
  #8 (permalink)
Trading Apprentice
Onsala Sweden
 
Futures Experience: Intermediate
Platform: Multichart
Broker/Data: InteractiveBrokers, eSignal
Favorite Futures: OMXS30
 
Posts: 28 since Nov 2016
Thanks: 21 given, 1 received

Hello,

I want to find and delete character " (shit 2 - ASCII(34)) from a string.
Is there any function like ASCII(34) in EasyLanguage? (Because I can not write the character " in my code.)

EX: How do I write: Instr(MyStr,""") ?

Best Regards


Last edited by ShahramTor; May 1st, 2017 at 03:14 AM.
Reply With Quote
 
  #9 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,328 since Apr 2013
Thanks: 212 given, 755 received

ShahramTor,

take a look at the reserved word DoubleQuote, this might be helpful here.

Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #10 (permalink)
Trading Apprentice
Onsala Sweden
 
Futures Experience: Intermediate
Platform: Multichart
Broker/Data: InteractiveBrokers, eSignal
Favorite Futures: OMXS30
 
Posts: 28 since Nov 2016
Thanks: 21 given, 1 received



ABCTG View Post
ShahramTor,

take a look at the reserved word DoubleQuote, this might be helpful here.

Regards,

ABCTG

Perfect. Thanks!

Reply With Quote

Reply



futures io > > > > > How to split a sting with comma and put into an array

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

FIO Journal Challenge featuring NinjaTrader ($2,000+ of prizes)

May

An overview of volumetric analytical tools w/Sergey Sokolov @ PTMC

Elite only

John Hoagland (TBA)

Elite only

FuturesTrader71 Extended Ask Me Anything (AMA)

Elite only

Pete @ Jigsaw Trading (TBA)

Elite only

John @ No BS Day Trading (TBA)

Elite only

An Afternoon with FIO member Softsoap (being rescheduled)

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
6E with 4 or 5 digits after the comma bart007 Currency Futures 19 January 15th, 2016 10:39 AM
Buyer Beware: Will Your Bond Fund Sting You? Quick Summary News and Current Events 0 December 13th, 2012 06:50 PM
Would-be Jihadist Chicago teenager tries to blow up bar, arrested in FBI sting kbit News and Current Events 0 September 16th, 2012 10:58 AM
here's way to convert tick data from NT to comma-separated format, with Mac or Linux theorist Platforms and Indicators 1 July 1st, 2012 04:00 AM
Why Sanctions Against Iran Might Sting More This Time* Quick Summary News and Current Events 0 December 28th, 2011 05:50 PM


All times are GMT -4. The time now is 02:36 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-05-27 in 0.12 seconds with 19 queries on phoenix via your IP 54.196.17.193