Trying to debug someone else's javascript code. There is a line that
looks like this:
req = req.substring(r eq.length-2, req.length); From what I can gather in their comments, they want to capture the last
two characters of the string "req".
I'm guessing that the above line won't do that, and they want to change
it to
req = req.substring(r eq.length-1, 2);
In other words, the parameters are starting position, and length. Is
that correct?
Dennis Hancy
Eaton Corporation
Cleveland, OH 6 9331 de*********@eat on.com wrote: Trying to debug someone else's javascript code. There is a line that looks like this:
req = req.substring(r eq.length-2, req.length);
From what I can gather in their comments, they want to capture the last two characters of the string "req".
I think it's what that do
req = req.substring(r eq.length-1, 2);
In other words, the parameters are starting position, and length. Is that correct?
Exactly not !
foo.substring(s tart,end)
or, in this case :
foo.substring(s tart);
--
Stephane Moriaux et son [moins] vieux Mac de*********@eat on.com said: Trying to debug someone else's javascript code. There is a line that looks like this:
req = req.substring(r eq.length-2, req.length);
From what I can gather in their comments, they want to capture the last two characters of the string "req".
I'm guessing that the above line won't do that, and they want to change it to
req = req.substring(r eq.length-1, 2);
In other words, the parameters are starting position, and length. Is that correct?
No:
substring(index A, indexB)
substring extracts characters from indexA up to
but not including indexB. de*********@eat on.com wrote: Trying to debug someone else's javascript code. There is a line that looks like this:
req = req.substring(r eq.length-2, req.length);
From what I can gather in their comments, they want to capture the last two characters of the string "req".
I'm guessing that the above line won't do that, and they want to change it to
req = req.substring(r eq.length-1, 2);
In other words, the parameters are starting position, and length. Is that correct?
No!
function lastNLetters(st r,N){
return str.substring(s tr.length-N);
}
alert(lastNLett ers("abcde",3)) ;
Mick de*********@eat on.com wrote: req = req.substring(r eq.length-1, 2);
In other words, the parameters are starting position, and length. Is that correct?
FYI: This could have been easily looked up in online/offline javascript
documentation. The group FAQ has links to online documentation.
comp.lang.javas cript FAQ - http://www.jibbering.com/faq/
You are likely thinking of substr, whose second parameter is length.
Use the MS Script Editor included free with MS Office 2002 and above,
for debugging Internet Explorer (IE).
This subject is of great interest to many JS developers, as there is no
obvious, low cost way to do sophisticated debugging in
IE6 other than to use the debugger described below, which is horribly
documented otherwise. I feel debugging is an important aspect of
projecting the useability of the language and needs to be made more
clear for new users.
Jeff Papineau yo**@mandala.co m
<FAQENTRY>
This is a page that describes how to install and use the MS Script
Editor to debug Javascript in Internet Explorer ( IE ). It has a
powerful debugger built into it that works really well for developers
supporting IE5+. This debugger/editor included with most versions of
Microsoft Office. http://www.mandala.com/javascript/debug_javascript.html
..NET programmers may have better tools (VStudio) but this comes in
really handy for anyone developing with JSP and PHP and other dynamic
scripting languages which embed javascript, as well as any HTML page
using Javascript in Internet Explorer that needs a (almost) free
debugging environment.
</FAQENTRY> de*********@eat on.com wrote: Trying to debug someone else's javascript code. There is a line that looks like this:
req = req.substring(r eq.length-2, req.length);
From what I can gather in their comments, they want to capture the last two characters of the string "req".
I'm guessing that the above line won't do that, and they want to change it to
req = req.substring(r eq.length-1, 2);
In other words, the parameters are starting position, and length. Is that correct?
Dennis Hancy Eaton Corporation Cleveland, OH This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ja |
last post by:
Hello,
I am trying to combine/substring parts of three different fields into
one. For example, in sql, the syntax is as follows:
Once the extra field has been added to the table,
update xtable
set field1 = substring(field2, 1, 5) + substring(field3, 1, 5) +
substring(field4, 1, 10)
|
by: joseph speigle |
last post by:
hi,
Does anybody know offhand what is the correct way to use substr to extract the domain name from a client_referer column as logged by mod_pgsqllog (httpd module), by correcting the following:
the file 'hostname.sql' is pl/pgsql
main=> \e hostname.sql
ERROR: syntax error at or near "http" at character 290
|
by: Duncan Allen |
last post by:
Hi,
Using C# I'm trying to use the substring method of a string variable but it
just generates an "error: 'variable.Substring' does not exist " exception -
how do I fix this ?
code example:
string creationDateStr = string.Empty;
string anotherStr = "";
|
by: Rob R. Ainscough |
last post by:
What sick saddistic person came up with the JavaScript language syntax? And
was it the same person (or group of people) that came up with the HTML
syntax??
OMG, has no one noticed this hopeless poor choice of language syntax? And
why-o-why is it case sensitive? Is it just a carry over from light weight
parsers? If we can't get out of...
|
by: Daviso |
last post by:
Hi.
I hava an input like this
<td><input name=numberA> </td>
and a button with a javascript function in onclick event.
I want to control that the first element of the value I have introduced in
numberA will be different and make a conditional
| |
by: windandwaves |
last post by:
Hi Folk
I have the following string:
http://www.myurl.com/folderbit/moerfiasdfsadf/sdaf/01354.jpg
and I want to extract the filename from it.
Do you know how to do this, if I don't know the exact names of the folders,
etc...
|
by: Derek Hart |
last post by:
This is probably so simple. I am doing a SelectSingleNode to get the value
from an XPath statement, and I simply want the 3 leftmost characters. I
cannot get the syntax to work:
//Client/Names/Name/@display_name
So I have tried:
substring(//Client/Names/Name/@display_name,1,3)
|
by: JJA |
last post by:
I'm looking at some code I do not understand:
var icons = new Array();
icons = new GIcon();
icons.image = "somefilename.png";
I read this as an array of icons is being built.
An element of the array is an object itself but what is this syntax of
the consecutive double quotes inside the brackets ?
|
by: Jean-Guy Mouton |
last post by:
Hello,
I am teaching myself Dom scripting with Javascript. I do not understand
how to get a substring. If I have strings in the form:
"This is string number 1"
How can I put "1" into a variable to use it elsewhere? I thought I
could use the function split and create an array but I have different
string lengths with a variable number of...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |