python a[1 :] 的 javascript 简写

标签 javascript python string substring

所以我在 javascript 中有一个字符串

var s="may the force";

我只想要部分, 在 python 中我可以做 s[4:],所以有 javascript 中有任何等价物吗?

最佳答案

你可以使用:

var s = "may the force";
var t = s.substring(4);

alert(t); //alerts "the force"

检查这个Fiddle

关于python a[1 :] 的 javascript 简写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15926979/

相关文章:

python - 在 Python 中实现类似集合的类的交集运算符

c - 如何从 char 函数返回字符串

javascript - 使用 JavaScript 定位 Flash 对象

javascript - 如何在 HTML5 Canvas 中的两个文本对象之间绘制二次曲线?

javascript - 将值从父级传递给子级(打开)窗口

java - 如何从java中的拆分中计算子字符串的数量

c# - C#字符串的$修饰符是什么

javascript - xLabel的个数大于数据的长度

python - 'S 3' object has no attribute ' put_object_retention'

Python collections.Counter 似乎打破了原来的列表