|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
if i had a string which looked like this :
,apple, orange, grape, tomatoes how do i remove the first character[,] from the string using the trim() function? |
|
#2
|
|||
|
|||
|
Well it depends...
Is the first character *ALWAYS* going to be a comma[,] If it is then simply use this technique: <% Dim MyString MyString = ",apple, orange, grape, tomatoes" Response.Write Right(MyString,Len(MyString)-1) %> But if it's NOT(meaning the comma being the first character) you will have to **FIRST** look at the first character and if it is a comma then use the above technique, if it's NOT a comma then simply do nothing...here is an example: <% Dim MyString MyString = ",apple, orange, grape, tomatoes" If Left(MyString, 1) = "," Then Response.Write Right(MyString,Len(MyString)-1) End If %> NOTE: You may find many different ways to achieve what you want, this is just an example of what you *could* do/use! Hope this helps! Sincerely Vlince |
|
#3
|
|||
|
|||
|
why not just?
PHP Code:
or if you're reallly hardcore about trim you could just split on , and then remove all spaces on both sides of the string... |
|
#4
|
|||
|
|||
|
Of course you could/can use the Split() but didn't know if the poster wanted an array in return!
Like I said, You may find many different ways to achieve what you want, this is just an example of what you *could* do/use! Vlince |
|
#5
|
|||
|
|||
|
Thanks Vlince !
That's was te results i'm expecting. I will remove those unwanted characters those then break up the strings into array and store it in a combo box. |
|
#6
|
|||
|
|||
|
Thanks Vlince !
That's was te results i'm expecting. I will remove those unwanted characters those then break up the strings into array and store it in a combo box. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Trimming Strings |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|