473,584 Members | 2,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mystry characters,

Hi

I have a field called method, which has values like
App,BCC,DED

using the below function im trying to delimit with ":", so the values
should be like
"App","BCC","DE D"

but the sLookupKey has a value like:
App":"BCC":"DED ":"

2 issues are above, the first " is missing
the last it adds up with :" again for value that is not available

var sFieldVal = trim(document.f orms[0].Method.value);
var sFieldValArray = null;
var sLookupKey = "";

if ( sFieldVal.index Of(",") != -1 )
{
sFieldValArray = sFieldVal.split (",");
for (n=0; n<sFieldValArra y.length; n++)
{
sLookupKey += (sFieldValArray[n]+'":"');
}
}
else
{
sLookupKey = sFieldVal;
}

can you pls. help
Sathya

Mar 16 '06 #1
2 1078
Satya said the following on 3/16/2006 7:08 AM:
Hi

I have a field called method, which has values like
App,BCC,DED

using the below function im trying to delimit with ":", so the values
should be like
"App","BCC","DE D"

but the sLookupKey has a value like:
App":"BCC":"DED ":"

2 issues are above, the first " is missing
the last it adds up with :" again for value that is not available

var sFieldVal = trim(document.f orms[0].Method.value);
var sFieldValArray = null;
var sLookupKey = "";
sLookupKey = "\"";

if ( sFieldVal.index Of(",") != -1 )
{
sFieldValArray = sFieldVal.split (",");
for (n=0; n<sFieldValArra y.length; n++)
{
sLookupKey += (sFieldValArray[n]+'":"');
}


sLookupKey = sLookupKey.subs tring(0,sLookup Key.length-2);

That is it at it's simplest. There are other ways.
Add the leading " and then strip the trailing :" that you don't want.

And please don't use tabs in posted code, use single or double spaces
per tab.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 16 '06 #2
Satya wrote:
I have a field called method, which has values like
App,BCC,DED

using the below function im trying to delimit with ":", so the values
should be like
"App","BCC","DE D"

but the sLookupKey has a value like:
App":"BCC":"DED ":"

2 issues are above, the first " is missing
the last it adds up with :" again for value that is not available
Please learn to debug (your) code. There are a number of acceptable
script debuggers out there, and you can also use the window.alert()
method for debugging. <URL:http://jibbering.com/faq/>
[code]


Your indentation is awkward, to say the least. You make it look like
as if the rest of the code would be part of the assigned value of
`sFieldVal'.
PointedEars
Mar 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
47804
by: Pikkel | last post by:
i'm looking for a way to replace special characters with characters without accents, cedilles, etc.
43
3721
by: Vladimir | last post by:
Method UnicodeEncoding.GetMaxByteCount(charCount) returns charCount * 2. Method UTF8Encoding.GetMaxByteCount(charCount) returns charCount * 4. But why that? Look: /* Each Unicode character in a string is defined by a Unicode scalar value, also called ...
4
3839
by: wob | last post by:
Many thanks for those who responded to my question of "putting greek char into C string". In searching for an solution, I noticed that there are more than one version of "Extended ASCII characters"(No. 128 to 255) . e.g., in one version No. 224 is the symbol alpha, in another, it's a "a" with a ` on it... How come? You can see it here: ...
35
436
by: Vladimir | last post by:
Method UnicodeEncoding.GetMaxByteCount(charCount) returns charCount * 2. Method UTF8Encoding.GetMaxByteCount(charCount) returns charCount * 4. But why that? Look: /* Each Unicode character in a string is defined by a Unicode scalar value, also called ...
11
11129
by: Ron L | last post by:
I have a barcode scanner which uses a "keyboard wedge" program so that the data it scans comes through as if it was typed on a keyboard. I am trying to have the data in the barcode be displayed in a text box. I know that there are certain control characters embedded in the data that I want to display substitutions for in the text box, for...
0
7829
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...
1
7940
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6587
agi2029
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...
1
5705
isladogs
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...
0
5379
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3824
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...
0
3850
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2336
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1438
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.