Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 02:19:03 +0000



SCSting::Left does not work

View Count: 609

[2019-04-20 03:54:25]
User189399 - Posts: 43
I have tried with the sample code from SC.

SCString TestStr1="It is a test";
TestStr1.Left(-5);
sc.AddMessageToLog(TestStr1,0); //Output "It is a test" not the expected "It is a"
[2019-04-20 04:21:57]
Sierra Chart Engineering - Posts: 104368
You cannot use a negative number with Left. It needs to be a positive number.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2019-04-24 08:37:24]
User189399 - Posts: 43
I captured the description of SCString::Left from the SC web site
ACSIL Programming Concepts

It said the count support -ve number. Pls note I have also tested with +ve count number. It return the same result without removal the chars from the left.

SCString::Left()
Type: Function

SCString Left(int Count) const;

The Left() function returns the substring from the SCString object that is the number of characters defined by Count starting from the left side (beginning) of the SCString object when Count is positive. If Count is negative, then the substring starts at the left side (beginning) of the SCString ojbect, but has Count number of characters removed from the right side (end) of the SCString object. If Count is negative and would result in the return of no data, then a NULL string is returned.
[2019-04-24 09:11:12]
Sierra Chart Engineering - Posts: 104368
We do not know where you are making a mistake. There are definitely no problems. This has been verified with this test code:
  SCString Test("Test");
  SCString LeftString = Test.Left(2);

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2019-04-24 09:11:33

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account