📅  最后修改于: 2022-03-11 14:48:07.143000             🧑  作者: Mango
void main() {
print(strip(strip(strip(strip(strip(" [(,'Sample String',)] ", " "), "[]"), "()"), ","), "''"));
//Output: "Sample String"
}
String strip(String string, String char)
{
string = (string.startsWith(char[0]) && string.endsWith(char[char.length - 1]))
? (){string = string.substring(1);
string = string.substring(0, string.length - 1); return string;}()
: string;
return string;
}