Current location: Hot Scripts Forums » Programming Languages » PHP » [SOLVED] Delete one character


Delete one character

Reply
  #1 (permalink)  
Old 09-23-09, 04:09 AM
noXy noXy is offline
Newbie Coder
 
Join Date: Sep 2009
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Delete one character

Hi guys, I'm tryin' to sort out this problem for last 2 days with no luck, if anyone could help me with it
I would be very apreciated.

I need to translate over 4000 lines from one language, to other I decided to refresh my php knowledge. I allmost did everything, just after translation, translator add's a (space) after symbol. In example it would be:

original: %d documents expunged.
translated: % d documents expunged.

it's translated from english to english just for example.
Is there any way to delete one character(space) after symbol "%" in result?

I do locate it using

PHP Code:

$pos strpos($cleann"%"); 
$sym strlen($pos); 
echo 
"<br>$sym"
and I want to delete only that space, not all spaces in string.
sometimes % s is not the start of the string, I mean sometimes its in the middle of the string.



I'm using google Gtranslator to do it.

Please help me out.

Marius

Last edited by noXy; 09-23-09 at 04:19 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-23-09, 05:01 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
PHP Code:

$str preg_replace('~% ([ds])~''%$1'$str); 

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
The Following User Says Thank You to Nico For This Useful Post:
noXy (09-23-09)
  #3 (permalink)  
Old 09-23-09, 05:14 AM
noXy noXy is offline
Newbie Coder
 
Join Date: Sep 2009
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Thanks

Thank you for a reply, I think it should work. I just skipped that part for a while Thank you again.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


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

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Delete range of entries from database!! priyam ASP 1 09-29-08 02:11 PM
Wanted to replace special characters in MS Access using VB, but more than 1 character cebuy Visual Basic 3 12-04-05 06:30 PM
How to replace extended Character with character luv_suresh Perl 1 06-22-05 01:16 AM
Delete row from mysql error. bigkid PHP 1 08-05-04 10:36 PM
i know how to delete a file! but how to delete a directory? forcer JavaScript 3 01-28-04 08:00 AM


All times are GMT -5. The time now is 12:19 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.