473,396 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Remove the last comma

190 100+
Hi

I have this (for sampple)

abc,cde,efg,ghc,

How can i remove this last ,

I knew there is a option using reqular expreesion but could not find the answer....
Aug 21 '08 #1
3 2088
maheswaran
190 100+
Sorry guys i got the answer


use like this

$string=eregi_replace(',$', '', $string);
Aug 21 '08 #2
you can also do this in following way.

$String = substr($String, 0, strlen($String) - strlen(','));
Aug 21 '08 #3
FLEB
30
You can also do it with rtrim:

[PHP]rtrim($string, ',');[/PHP]
Aug 21 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: ted | last post by:
I'm having trouble using the re module to remove empty lines in a file. Here's what I thought would work, but it doesn't: import re f = open("old_site/index.html") for line in f: line =...
4
by: Stitch Jones | last post by:
I'm trying to get part of my perl script using a regex to get rid of an entire field between two ,'s I'm doing this to get a .csv formated alot nicer. here is an example of my issue user...
12
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are...
3
by: blackdevil1979 | last post by:
Hi, I use a combobox to get a list of fruits (_SelectedIndexChanged)... I manage to get Apple, Orange, Grape, The question: How to get rid of the last comma (Grape , <--)
6
by: Rimuen | last post by:
Have a string contains numbers from database. But there is similar numbers want to remove Example: 1,3,6,6,6,12,13,14,15,15,15,15 Want to remove the similar numbers so it would be like:...
5
by: SuvarnaChaudhari | last post by:
Thanks lot!Its working,but I have again one doubt.I have created string but it looks like ('3435','4546','546',).So plz tell me how to remove that last one comma,so that I can pass it thru sql query...
13
by: SuvarnaChaudhari | last post by:
Hi,I am new to .net. As per ur guidance I tried myString = myString.SubString(0,myString.Length-1); I also used str.lastindexof n str.remove,but by using this I m gettin string as ' (B193 '' H13 ''...
2
by: Dennis | last post by:
Here is what I am trying to do... I have an XML doc that looks like: <root> <node>value1</node> <node>value2</node> <node>value3</node> <node>value4</node> </root>
4
anfetienne
by: anfetienne | last post by:
hi im back again.......i have a code to create strings and save it within a text file to pass variables to flash. im using the string format below. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.