473,320 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to change integer to string

Hi i have function in script. I did a small calculation in that function when i try to pass a value to in Field thet only passes integer value. But i need to pass both String and the integer value. So is it possible to convert from integer to string. Please let me know.

Thanks and Regards,
Kiran Nandamudi
Jan 17 '08 #1
3 17683
r035198x
13,262 8TB
Hi i have function in script. I did a small calculation in that function when i try to pass a value to in Field thet only passes integer value. But i need to pass both String and the integer value. So is it possible to convert from integer to string. Please let me know.

Thanks and Regards,
Kiran Nandamudi
Javascript's type checking system is such that you can pass an integer to a function that "expects" a string.
Jan 17 '08 #2
kaleeswaran
132 100+
Hi i have function in script. I did a small calculation in that function when i try to pass a value to in Field thet only passes integer value. But i need to pass both String and the integer value. So is it possible to convert from integer to string. Please let me know.

Thanks and Regards,
Kiran Nandamudi
you can use:
String to Integer convertion
parseFloat(var)
Jan 18 '08 #3
gits
5,390 Expert Mod 4TB
hi ...

you did get the answer in post #2 already, but let me explain that in more detail a little bit. JavaScript uses implicit type-casting dependent on what the OPERATION expects. so when you have a number-type and the operation expects a string javascript will cast the number to a string. in case you want to do it explicitly before then you may use:

Expand|Select|Wrap|Line Numbers
  1. var n = 1;
  2. var s = n.toString();
  3.  
  4. // now var s has a string '1' assigned :)
  5.  
note: sometimes the implict typecasting is a little bit tricky ... have a look at this:

Expand|Select|Wrap|Line Numbers
  1. // we compare an empty string to a number 0
  2. var val = '' == 0;
  3.  
  4. // val is now true since we compare different types and js
  5. // implcitly casts the types
  6. // so val will be true in the next examples too:
  7. val = '       ' == 0;
  8. val = '0' == 0;
  9. val = '0000000' == 0;
  10.  
  11. // in case you need to check the types too and avoid
  12. // the casting here you could use the identity-operator ===
  13. val = '0' === '';
  14.  
  15. // now val is false since the types are different
  16.  
kind regards
Jan 18 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Yves-Alain NICOLLET | last post by:
I have a script that opens a small window containing a button which when clicked performs a find to the next occurence of a string. It works well when the string is made of only one word or of...
13
by: coinjo | last post by:
Is there any function to determine the length of an integer string?
37
by: sam44 | last post by:
Hi, At startup the user log on and chooses the name of a client from a dropdownlist, which then changes dynamically the connection string (the name of the client indicates which database to use)....
1
by: Stile213 | last post by:
What's the easiest way to input an integer string using the cin function? The string will be single digits and from 1 to 5 elements long.
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
5
by: Tobi | last post by:
Hi, i have a problem. I want to get Ascii Caracters out of a 7 Bit long Byte, that should be no problem with the getString Method, but i dont have a byte i have a String which contains only an...
7
by: Jim | last post by:
Hi guys, The variable '$pixels' in the code below may be an integer type or an integer represented as a string type. I need to check if the value is indeed one of these. Is the following code...
6
by: little83 | last post by:
Dear all i wrote one class to deal with sql database to insert and read data from that class only...and based on that one of the parmeters or the class is the sqlconnection SqlConnection...
0
by: thomasbihn | last post by:
I'm new to C# development. I am familiar with setting up connection strings and working with databases in ADO in VB6, but this is a bit more involved. I have a very basic application in which I...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.