Login Page - Create Account

Support Board


Date/Time: Sun, 19 May 2024 17:52:27 +0000



Post From: How to find the location of a text string within an SCString variable

[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.