This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- CharReplace function
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 10, 2007
01:34 AM
CharReplace function
Is there a bug in CharReplace Function?
When I run the following code I get the value '10-10-2007' in the first MessageBox and then "10" in the second MessageBox.
Instead of the string replaced with null values where ever there are "-" characters, the string seems to be cut.
This is not simply due to the MessageBox function as it is propogated throughout the installer.
How else can I go about replacing "-" with a "" or null value?
When I run the following code I get the value '10-10-2007' in the first MessageBox and then "10" in the second MessageBox.
Instead of the string replaced with null values where ever there are "-" characters, the string seems to be cut.
This is not simply due to the MessageBox function as it is propogated throughout the installer.
GetSystemInfo(DATE, nvDate, svDate);
MessageBox ("svDate = " + svDate, INFORMATION);
CharReplace(svDate, STRTOCHAR(':'), STRTOCHAR('\0'), 0);
MessageBox ("svDate = " + svDate, INFORMATION);
How else can I go about replacing "-" with a "" or null value?
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 10, 2007
05:42 AM
The '\0' character indicates an End of Line and null characters have special values within strings.
How about extracting substrings like this:
How about extracting substrings like this:
GetSystemInfo(DATE, nvDate, svDate);
MessageBox ("svDate = " + svDate, INFORMATION);
listID = ListCreate (STRINGLIST);
StrGetTokens (listID, svDate, "-");
nResult = ListGetFirstString (listID, svString);
svDate = "";
while (nResult != END_OF_LIST)
svDate = svDate + svString;
nResult = ListGetNextString (listID, svString);
endwhile;
MessageBox ("svDate = " + svDate, INFORMATION);
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 10, 2007
06:18 PM
Great. Thankyou.