📜  如何将此python代码转换为飞镖? - 飞镖代码示例

📅  最后修改于: 2022-03-11 14:48:07.143000             🧑  作者: Mango

代码示例3
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;
}