【问题标题】:How to Split String in React Js?如何在 React Js 中拆分字符串?
【发布时间】:2023-02-02 16:17:13
【问题描述】:

如何从字符串“C:\Program Files (x86)\Google\Update\GoogleUpdate.exe”中提取“GoogleUpdate.exe”?

【问题讨论】:

    标签: reactjs


    【解决方案1】:

    const str = "C:\Program Files (x86)\Google\Update\GoogleUpdate.exe";
    const parts = str.split("\");
    const fileName = parts.pop();
    
    console.log(fileName); // outputs "GoogleUpdate.exe"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-17
      • 1970-01-01
      • 2021-07-29
      • 1970-01-01
      • 1970-01-01
      • 2011-11-11
      • 2011-06-26
      • 2017-06-06
      相关资源
      最近更新 更多