NexusFi: Find Your Edge


Home Menu

 





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


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one ABCTG with 4 posts (6 thanks)
    2. looks_two ShahramTor with 3 posts (0 thanks)
    3. looks_3 huzisg with 2 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 8,968 views
    2. thumb_up 6 thanks given
    3. group 4 followers
    1. forum 10 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
huzisg
HANGZHOU,ZHEJIANG,CHINA
 
Posts: 6 since Aug 2016
Thanks Given: 0
Thanks Received: 0

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

Can you help answer these questions
from other members on NexusFi?
$24.5 Billion Record Month: Prediction Markets Shatter A …
Prediction Markets & Event Contracts
Iran Ceasefire Surges to 19.5% on US 15-Point Plan -- 82 …
Prediction Markets & Event Contracts
CPI Eve: Fed Hike Odds Hold at 52% for the First Time, I …
Prediction Markets & Event Contracts
CFTC Approves First US Bitcoin Perpetual Futures -- Kals …
Traders Hideout
Iran Fired a Missile at Israel Last Night. The $8M June …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642


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


Follow me on X Reply With Quote
Thanked by:
  #4 (permalink)
huzisg
HANGZHOU,ZHEJIANG,CHINA
 
Posts: 6 since Aug 2016
Thanks Given: 0
Thanks Received: 0

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


Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

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


Follow me on X Reply With Quote
Thanked by:
  #6 (permalink)
ShahramTor
Onsala Sweden
 
Posts: 28 since Nov 2016
Thanks Given: 22
Thanks Received: 1


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)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

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


Follow me on X Reply With Quote
Thanked by:
  #8 (permalink)
ShahramTor
Onsala Sweden
 
Posts: 28 since Nov 2016
Thanks Given: 22
Thanks Received: 1

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


Reply With Quote
  #9 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

ShahramTor,

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

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:
  #10 (permalink)
ShahramTor
Onsala Sweden
 
Posts: 28 since Nov 2016
Thanks Given: 22
Thanks Received: 1



ABCTG View Post
ShahramTor,

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

Regards,

ABCTG

Perfect. Thanks!


Reply With Quote




Last Updated on August 18, 2018


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts