Re: direct string manipulation (like in c)

2004-08-19 Thread Christopher J. Bottaro
James Edward Gray II wrote: > Then you didn't read the documentation I sent you the link for. ;) > > A negative index counts backwards from the end of the string. i did read it. maybe i should have asked my question like this: "why is the 3rd argument negative when you can simply say: substr($

Re: direct string manipulation (like in c)

2004-08-19 Thread James Edward Gray II
On Aug 19, 2004, at 11:55 AM, Christopher J. Bottaro wrote: Gunnar Hjalmarsson wrote: You can use substr() as an rvalue: substr($str1, 4, 8 - length $str1, $str2); or if the length of $str1 is given: substr($str1, 4, -4, $str2);# probably fastest i don't understand why the 3rd

Re: direct string manipulation (like in c)

2004-08-19 Thread Christopher J. Bottaro
Gunnar Hjalmarsson wrote: > You can use substr() as an rvalue: > > substr($str1, 4, 8 - length $str1, $str2); > > or if the length of $str1 is given: > > substr($str1, 4, -4, $str2);# probably fastest i don't understand why the 3rd argument is negative. given $str1 = 'xxx

Re: direct string manipulation (like in c)

2004-08-19 Thread Gunnar Hjalmarsson
Christopher J. Bottaro wrote: say i have two strings "" and "". i want to replace characters 4-7 in the first string with the second string with an emphasis on speed. basically i want to do what can be done in c with the following: char str1[13] = ""; char *str2 = "

Re: direct string manipulation (like in c)

2004-08-19 Thread James Edward Gray II
On Aug 19, 2004, at 10:55 AM, James Edward Gray II wrote: On Aug 19, 2004, at 10:55 AM, Christopher J. Bottaro wrote: say i have two strings "" and "". i want to replace characters 4-7 in the first string with the second string with an emphasis on speed. perldoc -f substring Egad,

Re: direct string manipulation (like in c)

2004-08-19 Thread James Edward Gray II
On Aug 19, 2004, at 10:55 AM, Christopher J. Bottaro wrote: say i have two strings "" and "". i want to replace characters 4-7 in the first string with the second string with an emphasis on speed. perldoc -f substring Come back if you need a bigger hint. ;) James -- To unsubscrib