How to substring in JQuery?

Ads
 

How to substring in JQuery?

Hi,

I my JQuery application I am getting the value from server using Ajax. I have to substring the value in jQuery.

There is a variable in my program as follows:

var technologyName = "Language JavaScript";

I just want to take the value JavaScript from the above variable. Please let's know How to substring in JQuery?

Thanks

View Answers

January 21, 2013 at 11:24 AM

Hi,

There is no need to use the jQuery for getting the smaller from a big string.

JavaScript provides convenient function for this purpose.

Here is the description of the substring function of JavaScript:

string.substring(start, to);

from: value is required and it specifies the index from where program will start the extraction.

to: this is option value. If no value is specified all the string will extracted till end of the string.

Here is the complete example html and javascript code:

<html>
 <head>
  <title>JQuery Substring</title>
  <script lanuage="JavaScript">
    function test(){
        var technologyName = "Language JavaScript";
        alert("Technology:" + technologyName);
        technologyName = technologyName.substring(9);
        alert("Technology:" + technologyName);
    }
  </script>
 </head>

 <body>
  <a href="javascript:test()">Substring</a>
 </body>
</html>

Thanks

Ads









Related Tutorials/Questions & Answers:
How to substring in Java?
How to substring in JQuery?
Advertisements
How to check if a string contains a substring in iOS?
Java Substring
C String Substring
ModuleNotFoundError: No module named 'substring'
C get Substring from String
find and substring
JavaScript substring length
Use of <fn:subString(String, int, int)> Tag of JSTL
help with substring in c programing
SubString help - Java Beginners
C Programming SubString Program
JavaScript indexOf substring
Search string using substring
SubString in Java
JPA Substring() Function
String substring(int beginIndex)
find a substring by using I/O package
String substring(int beginIndex, int endIndex)
Taking Substring
Java SubString
how to code
how to update
how to display?
how to display?
how to display?
How to include?
How to connect
how to solve
How to add

Ads