简体   繁体   English

在 Typescript 中,如何将字符串转换为字符串数组?

[英]In Typescript, how do I convert a string of strings as an array of strings?

Probably similar to other questions.可能与其他问题类似。 My example string looks like this: "['one', 'two', 'three']" Can I do it without resorting to Regex or so?我的示例字符串如下所示:“['one', 'two', 'three']” 我可以在不使用 Regex 的情况下做到这一点吗?

Thanks!谢谢!

your example string is almost valid JSON, so smth like playground您的示例字符串几乎是有效的 JSON,所以就像游乐场

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM