find clausen <> writes:
[color=blue]
> How do I write part of a string up to a certain character,
> or get it in to a variable.[/color]
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 - lrn@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
On 02 Oct 2003 13:43:36 +0200, Lasse Reichstein Nielsen
<lrn@hotpop.com > wrote:
[color=blue]
> Get it into a variable? I can't guess that one.[/color]
:-)
I have this:
fv = document.title. substr(0,20)
But I want to find @ in document.title
And put that part of the string in fv
In article <t98onvsa7hnogr 5qaa7bn6f723pr5 p5m2o@4ax.com>, find clausen <>
enlightened us with...[color=blue]
> I have this:
> fv = document.title. substr(0,20)
>
> But I want to find @ in document.title
> And put that part of the string in fv
>
>[/color]
Which part of the string? The part from 0 to '@' or the part from '@' to
the end?
Inclusive or exclusive of the '@'?
--
-------------------------------------------------
~kaeli~
All I ask for is the chance to prove that money
cannot make me happy.
find clausen <> wrote in message news:<ulonnv8jv v1i7s1kdshm1855 9nkc9dqh4h@4ax. com>...[color=blue]
> How do I write part of a string up to a certain character,
> or get it in to a variable.
>
> TIA[/color]
On Thu, 2 Oct 2003 09:38:46 -0500, kaeli
<infinite.possi bilities@NOSPAM att.net> wrote:
[color=blue]
> Which part of the string? The part from 0 to '@' or the part from '@' to
> the end?
> Inclusive or exclusive of the '@'?[/color]
In article <aononvkdcvhosl l8tj1ng115vf43h rrua8@4ax.com>, find clausen <>
enlightened us with...[color=blue]
> On Thu, 2 Oct 2003 09:38:46 -0500, kaeli
> <infinite.possi bilities@NOSPAM att.net> wrote:
>[color=green]
> > Which part of the string? The part from 0 to '@' or the part from '@' to
> > the end?
> > Inclusive or exclusive of the '@'?[/color]
>
> from 0 to @ -1
>
>[/color]
On Thu, 2 Oct 2003 12:51:08 -0500, kaeli
<infinite.possi bilities@NOSPAM att.net> wrote:[color=blue]
> fv = document.title. substring(0,doc ument.title.ind exOf("@"))
>
> Note on substr/substring: substr() has two arguments - the start and the
> length. substring() has two arguments - the start and the end.[/color]
That works perfect, thanx !
Then I will not pay you :[color=blue]
> All I ask for is the chance to prove that money
> cannot make me happy.[/color]
;-)
--
JRS: In article <ulonnv8jvv1i7s 1kdshm18559nkc9 dqh4h@4ax.com>, seen in
news:comp.lang. javascript, find clausen <?@?.?> posted at Thu, 2 Oct
2003 10:36:10 :-[color=blue]
>
>How do I write part of a string up to a certain character,
>or get it in to a variable.[/color]
Let the character be #, and the string example be S = 'abcd#xyz'
Comment