User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 397,767 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,470 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser:
Views: 9640 | Replies: 0
Reply
Join Date: Nov 2004
Posts: 1
Reputation: magicmarkuk is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
magicmarkuk magicmarkuk is offline Offline
Newbie Poster

Removing space from string

  #1  
Nov 6th, 2004
Hi

I am new to all of this so please forgive me if my question is either really obvious or indeed in the wrong forum.

I have had a script written for me that displays details of books e..t. title, author etc.

The string which holds the author seems to always have a space at the beginning of it. How can I remove the space (or indeed whatever other invisible character it is)?

The string value is $auth and the relevant part of the code (I think) is as follows:

if ($productauthor =~ /\|\|/i) {
@auth = split(/\|\|/, $productauthor);
foreach $auth (@auth) {
$auth =~ s/^\s+//g;
$auth =~ s/\s+$//g;

$authorurl .= "\&nbsp\;<a href=\"search.cgi?key=$auth&author=1\">$auth</a>\&nbsp\;";
}
}else {
$authorurl = "<a href=\"search.cgi?key=$productauthor&author=1\">$productauthor</a>";
}

If anyone can help me I would be most grateful.

Thanking you in anticipation.

Regards

Mark
Forum Administrator
www.accountancystudents.co.uk
... the site for ALL accountancy students
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Shell Scripting Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 4:13 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC