Support Board
Date/Time: Wed, 15 Jan 2025 15:56:28 +0000
How to find the location of a text string within an SCString variable
View Count: 1432
[2017-07-16 23:02:24] |
User787032 - Posts: 37 |
In ACSIL, is it possible to search an SCString variable for a given text value and return the position of the text once it has been located? My requirement is to output to the Message Log the information that follows immediately after the search text string. In C++, normally, we can use something like: int posn = SResp.find(Subtext); // find the position of the search text Subtext within the main string SResp
TextStr = SResp.substr(posn+5, 20); // get the 20 chars following the search text (subtext is 4 characters long) However, .find and .substr don't work on SCString. One workaround would be to use a std::string variable and use .find and .substr on that, but then it's not possible to output that std::string variable directly in AddToMessageLog(), and it's not possible to set an SCString variable equal to the contents of the std::string variable so that it can be output. Thanks in advance for any help. |
[2017-07-17 12:45:13] |
Sierra Chart Engineering - Posts: 104368 |
The answer given was from a user. Not Sierra Chart support. We are deleting it and we are also deleting your most recent post. We will be responding later after we update the documentation. 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 |
[2017-07-18 01:30:54] |
Sierra Chart Engineering - Posts: 104368 |
The closest function available is this one: ACSIL Programming Concepts: SCString::GetSubString() but then it's not possible to output that std::string variable directly in AddToMessageLog(), and it's not possible to set an SCString variable equal to the contents of the std::string variable so that it can be output. However, none of this is true. You can do all of this.Refer to: ACSIL Programming Concepts: Working with SCString, Text Strings and Setting ACSIL Structure Member Name Strings 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: 2017-07-18 01:31:11
|
[2017-07-18 20:38:24] |
User787032 - Posts: 37 |
Thanks for the update in the documentation for GetSubString. As you didn't mention .find(), can I assume that the find function doesn't work on SCString, only on std::string? |
[2017-07-18 21:43:25] |
Sierra Chart Engineering - Posts: 104368 |
Yes.
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 |
To post a message in this thread, you need to log in with your Sierra Chart account: