JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old February 25th, 2004, 04:18 AM
Kixer Kixer is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 7 Kixer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[Jscript]get a substring

Hi, is there an function which I can use to get a substring out of a text. In ASP I use left(string,pos) but now I need to declare it in a Javascript function so ASP won't work.

Tnx for your help!

Reply With Quote
  #2  
Old February 25th, 2004, 09:00 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
Check this example:

Code:
str = "I could have searched Google";
str.substring(22, 27)


You can use String.substring(a, b) to return the substring starting from the ath character up to but not including the bth character. The first character of a string is treated as character zero.

If a is less than zero substring will read the string from the first character. If b exceeds the string's length, then substring will read up up the the end of the string.

If a is equal to b, the empty string is returned.

If a is greater than b, substring will swap the start and end indices.

Reply With Quote
  #3  
Old February 25th, 2004, 09:42 AM
Kixer Kixer is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 7 Kixer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Tnx. I'd already searched at google but mostly I found large files with code to get a substring. I knew it would be simple.. I just hadn't the time searching for it.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > [Jscript]get a substring


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 3 hosted by Hostway