写一个字符串的一部分? [英] write part of a string ?
问题描述
如何将字符串的一部分写入某个字符,
或将其输入变量。
TIA
-
找到clausen
www.photopress.dk
推荐答案
find clausen<>写道:
find clausen <> writes:
如何将字符串的一部分写入某个字符,
或将其输入变量。
How do I write part of a string up to a certain character,
or get it in to a variable.
我不确定你想要做什么。
你想改变字符串的内容(最多一点)吗?在
那种情况下,你不可能。 Javascript字符串是不可变的。你必须创建
a新字符串,例如:
str =" dummy string" ;;
str =" new前缀" + str.substring(6);
alert(str); //提醒新前缀字符串
将其变为变量?我不能猜到那个。
/ L
-
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D''HTML:< URL:http://www.infimum.dk/HTML/ randomArtSplit.html>
''没有判断的信仰只会降低精神神圣。''
I am not sure exactly what you want to do.
Do you want to change the contents of a string (up to a point)? In
that case, you can''t. Javascript strings are immutable. You have to create
a new string, e.g.:
str = "dummy string";
str = "new prefix "+str.substring(6);
alert(str); // alerts "new prefix string"
Get it into a variable? I can''t guess that one.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D''HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
''Faith without judgement merely degrades the spirit divine.''
在文章< ll ***** *****@hotpop.com>, lr*@hotpop.com 启发了我们
with ...
In article <ll**********@hotpop.com>, lr*@hotpop.com enlightened us
with...
将它变成变量?我猜不出那个。
Get it into a variable? I can''t guess that one.
当然可以。 :)
str =" new prefix";
myNewVar = str.substring(4);
myNewVar现在是前缀。
--------------------------------- ----------------
~kaeli~
我所要求的是有机会证明这笔钱
不能让我开心。
http://www.ipwebdesign.net / wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
--------------------------------------- ----------
Sure you can. :)
str="new prefix";
myNewVar = str.substring(4);
myNewVar is now "prefix".
-------------------------------------------------
~kaeli~
All I ask for is the chance to prove that money
cannot make me happy.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
2003年10月2日13:43:36 +0200,Lasse Reichstein Nielsen
< lr*@hotpop.com>写道:
On 02 Oct 2003 13:43:36 +0200, Lasse Reichstein Nielsen
<lr*@hotpop.com> wrote:
把它变成一个变量?我不能猜到那个。
Get it into a variable? I can''t guess that one.
:-)
我有这个:
fv = document.title.substr(0,20)
但是我想在document.title中找到@
然后放一部分字符串在fv
-
找到clausen
www.photopress.dk
这篇关于写一个字符串的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!