i have a string
var s = "<DemoData xsi:nil="true"/>";
but ofcourse the string stops a " and starts again after true and the "
how can i make a sctring with " in it??
i have a string
var s = "<DemoData xsi:nil="true"/>";
but ofcourse the string stops a " and starts again after true and the "
how can i make a sctring with " in it??
found it just put an \ in front of it
var s = "<DemoData xsi:nil=\"true\"/>";
That should work, it works in regular java anyways. It should work in JavaScript.
thanks but it still doesnt work
this is the script
function optimizefile(a : FileInfo){
var reader : StreamReader = new StreamReader(File.OpenRead(FileLocation+"/savefiles/"+ a.Name));
var fileContent = reader.ReadToEnd();
reader.Close();
fileContent = fileContent.Replace("<DemoData xsi:nil=\"true\"/>"," ");
var writer : StreamWriter =new StreamWriter(File.OpenWrite(FileLocation+"/savefiles/"+ a.Name));
writer.Write(fileContent);
print(fileContent);
writer.Close();
}
tis is what i am tryng to delete[/quote]
“"true"” ?
no but thanks
This works for me.
yes but it will nnot work for me becaus i am not trying to replace <DemoData xsi:nil="true"/> but i am trying to replace
var fileContent = reader.ReadToEnd();
reader.Close();
print("FILE CONTENT: " + fileContent);
fileContent = fileContent.Replace("<DemoData xsi:nil=\"true\"/>"," ");
Add that print statement above and confirm that your fileContent contains the data you think it does. That DemoData string may not be exactly as you have in the replacement string. Note that it is case sensitive, and extra/less spaces will also cause it to not replace.
thanks for the tip it was just that i deleted a space so thats why it din’t work thnks