vBulletin Modifications

Truncate Variable

Welcome to vBHackers.com! - vBHackers Updates:

Go Back   vBulletin Modifications > General vBulletin Section > General vBulletin Discussion

Reply
 
LinkBack Thread Tools
Old 08-02-2006, 05:00 AM   #1
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default Truncate Variable

I have searched far and wide but can not find the answer xD

ok, so, how do i truncate (trim) characters off a string so it could have been x characters before but is 10 now?

Regards,
Nick.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 08-02-2006, 08:31 AM   #2
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default

ah got it from paul m at vborg




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-02-2006, 02:43 PM   #3
Coder
bairy's Avatar
Join Date: Jun 2006
Real Name: Chris
Location: Birmingham, UK
bairy is on a distinguished road

Default

$text = substr($text, 0, 10) for future readers.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-02-2006, 02:44 PM   #4
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default

0 means it starts at 0 and 10 means it wil stop at 10.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-02-2006, 02:46 PM   #5
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default

and if you want to add 3 dots on the end then do this:
You must first be a registered member to view any code.
then you can just define length as 17 and then it will be 20 chracters long the 17 actualy chracters + the 3 dots.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-03-2006, 12:38 AM   #6
Coder
Code Monkey's Avatar
Join Date: May 2006
Code Monkey is on a distinguished road

Default

That can be done in one line of code.

You must first be a registered member to view any code.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-03-2006, 05:00 AM   #7
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default

right not quite sure that does the exact same though.

Last edited by Nick R; 08-03-2006 at 06:11 PM..




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-03-2006, 12:16 PM   #8
Coder
Code Monkey's Avatar
Join Date: May 2006
Code Monkey is on a distinguished road

Default

It does, and it's more efficient.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-03-2006, 06:11 PM   #9
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default

I'm sure it is more efficient as it less bytes of info. doesn't mean i like it though :p




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable Help - Last Attachment shows on forumdisplay. Aceman General vBulletin Support 21 05-01-2007 01:37 AM
Post variable not working.. Nick R General vBulletin Support 3 07-27-2006 11:44 AM
Using a vBulletin variable somewhere else, like in PhotoPost Classifieds franklin General vBulletin Support 0 07-13-2006 12:12 PM
Cron Job Variable Nick R General vBulletin Support 4 07-06-2006 02:11 PM
Another blasted variable scope issue. tgreer General vBulletin Support 4 04-20-2006 09:19 PM


All times are GMT -3. The time now is 10:14 PM.

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc. (Patent Pending)