POSIBLE SOLUTION ABOUT implicit conversion

 
      MqlCalendarEvent event;
      string txtEN = StringReplace(event.name, "'", "");

ERROR

implicit conversion from 'number' to 'string'


Help me please...

Because I wanted to remove the apostrophe of text below


Japan Large Retailer's Sales y/y

 
Michael Quinatadcan Macasil Macasil: ERROR implicit conversion from 'number' to 'string'. Help me please... Because I wanted to remove the apostrophe of text below

You are using the StringReplace function incorrectly. Please read the documentation again.

It alters the source string and the return value is not a string. It is an integer with the number of replacements carried out.

Documentation on MQL5: String Functions / StringReplace
Documentation on MQL5: String Functions / StringReplace
  • www.mql5.com
StringReplace - String Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Michael Quinatadcan Macasil Macasil:

ERROR

implicit conversion from 'number' to 'string'


Help me please...

Because I wanted to remove the apostrophe of text below


Japan Large Retailer's Sales y/y

StringReplace() function returns the replacement count as integer. Here you are trying to save integer to a string so it's implicit conversion error. Your source string event.name had been changed in this function call, so it's not mandatory to save it in another string. You can use like this 

if(StringReplace(event.name,"'","")>0)
Print(event.name," changed successfully.");
 
Fernando Carreiro #:

You are using the StringReplace function incorrectly. Please read the documentation again.

It alters the source string and the return value is not a string. It is an integer with the number of replacements carried out.

Sir, thank you very much for attending my problem.

based on sample:

  string text="The quick brown fox jumped over the lazy dog.";
  int replaced=StringReplace(text,"quick","slow");
  replaced+=StringReplace(text,"brown","black");
  replaced+=StringReplace(text,"fox","bear");
  Print("Replaced: ", replaced,". Result=",text);
  
//  Result
//  Replaced: 3. Result=The slow black bear jumped over the lazy dog.
//

and my code:

 string txtEN = event.name;
 int txtRN=StringReplace(txtEN, "'", "");

and my problems are 100% SOLVED!!!

this text 

Japan Large Retailer's Sales y/y

are replace into

Japan Large Retailers Sales y/y

refer attached jpeg.

Again thank you Sir Fernando. 

Files:
SQLLITE.png  159 kb
Reason: