[H-GEN] char inset
Grant, Luke
lgrant at seven.com.au
Tue May 2 21:08:05 EDT 2000
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Please observe the list's charter. ]
thanks guys :)
problem fixed...we can now keep all those great tv advertisements you know
and love comming too you :)
Luke
--------------------------------------------
_____
\___//| Luke Grant
/ / Systems Administrator
/ / Maroochydore
/_/ 140-142 Horton Pde.
Channel 7 wk# +61754301737
mob# +61413317952
--------------------------------------------
-----Original Message-----
From: Christopher Biggs [mailto:chris at stallion.oz.au]
Sent: Wednesday, May 03, 2000 10:59 AM
To: general at lists.humbug.org.au
Subject: Re: [H-GEN] char inset
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Please observe the list's charter. ]
"Grant, Luke" <lgrant at seven.com.au> moved upon the face of the 'Net and
spake thusly:
> so what i need is a howto on the following in either bash or perl.
>
> "B43" which is the contents of a string variable must become "B043" and i
> have no idea how i can insert a char into a string in Bash or Perl.....and
i
> would rather not have to dust of my old "C" texts cause whilst i know that
> strings are treated as nice simple arrays of char in "C" i haven't coded
in
> it for over a year and would rather not start now.
In Perl, as always, TIMTOWTDI.
You can use regexps, pasting of substrings, or you can actually use
the substr() function as an lvalue! (This is seriously twisted.)
# Insert a substring
$foo = "B43";
substr($foo,1,0)="0";
# $foo now holds "B043".
You can replace a substring with a new substring by giving a nonzero
length to the substr lvalue:
# Replace a substring
$foo = "B43";
substr($foo,1,2)="666";
# $foo now holds "B666".
cjb.
--
Christopher Biggs -- chris at stallion.oz.au -- Stallion Technologies
Australia.
There's a bug in my mailer that mangles my sig but V guvax V'ir svkrq vg
abj.
Uneqyl jbegu qrpbqvat, jnf vg? Rznvy zr "Fhowrpg: fraqctcxrl" sbe zl CTC
xrl.
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.
More information about the General
mailing list