ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old September 24th, 2003, 04:15 AM
abones abones is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 75 abones User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Question Trimming Strings

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?

Reply With Quote
  #2  
Old September 24th, 2003, 05:35 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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

Reply With Quote
  #3  
Old September 24th, 2003, 09:38 AM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
why not just?
PHP Code:
 A split(string,", "


or if you're reallly hardcore about trim you could just split on , and then remove all spaces on both sides of the string...

Reply With Quote
  #4  
Old September 24th, 2003, 11:12 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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

Reply With Quote
  #5  
Old September 24th, 2003, 08:19 PM
abones abones is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 75 abones User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 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.

Reply With Quote
  #6  
Old September 24th, 2003, 09:26 PM
abones abones is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 75 abones User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Trimming Strings


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway