I have a String
, named a[1]. How can I remove "" to make the final output as below?
/data/user/0/com.xxx/xxx/ABC Home_2-2-2_12 Jan 2024-12 Jan 2024.pdf
Below is the code
var a = contentDisposition!.split(";");
debugPrint("eev ${a[1]}"); // filename="ABC Home_2-2-2_12 Jan 2024-12 Jan 2024.pdf"
var c = a[1].replaceAll("filename=", "");
var d = (c.trim());
var bytes = await consolidateHttpClientResponseBytes(response);
String dir = (await getApplicationDocumentsDirectory()).path;
File file = File("$dir/$d");
String path = file.path;
debugPrint(path); // /data/user/0/com.xxx/xxx/"ABC Home_2-2-2_12 Jan 2024-12 Jan 2024.pdf"
2
Answers
You can use
.replaceAll('"', '');
Add the above line in your code