|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
[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! ![]() |
|
#2
|
||||
|
||||
|
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. |
|
#3
|
|||
|
|||
|
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.
![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > [Jscript]get a substring |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|