Problem with StringReplace (% char)

 

If i try to replace a ' # '  or any other char with a ' % ' char this command is not working. It will be replaced by a blank.

Is there any way to make this possible?


string myText =  "TEST#TEST";

StringReplace(myText,"#","%"); 


I need this because i want to send open orders to my webserver by using http request. For example a symbol with name #NOK# is making troubles because in an URL a # symbol needs to be escaped by %23

 
Diego Cochiloco:

If i try to replace a ' # '  or any other char with a ' % ' char this command is not working. It will be replaced by a blank.

Is there any way to make this possible?


string myText =  "TEST#TEST";

StringReplace(myText,"#","%"); 


I need this because i want to send open orders to my webserver by using http request. For example a symbol with name #NOK# is making troubles because in an URL a # symbol needs to be escaped by %23

Bitte 1.) Den Rückgabewert der Funktion StringReplace() auswerten und 2.) ggf. auch den Fehlercode bzw. ins Log (Experten) schauen, ob da 'was steht.
Dokumentation zu MQL5: Stringfunktionen / StringReplace
Dokumentation zu MQL5: Stringfunktionen / StringReplace
  • www.mql5.com
StringReplace - Stringfunktionen - Nachschlagewerk MQL5 - Nachschlagewerk über die Sprache des algothitmischen/automatischen Handels für MetaTrader 5
 

Sorry für den Text auf Englisch, dachte ich schreibe im englischen Forum.

Problem hat sich gelöst, war meine eigene Dummheit. Ich habe die Ausgabe des Resultates mit PrintFormat (myText) ohne weitere Parameter genutzt anstelle von Print(myText).

Replace von # in % funktioniert einwandfrei mit der Funktion StringReplace


Sorry für die Verwirrung und trotzdem vielen Dank für die Hilfe.

Gruß

Diego

Grund der Beschwerde: