How to substring in JQuery?

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









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
ModuleNotFoundError: No module named 'substring'
C String Substring
Substring in java
Substring in java
find and substring
JavaScript substring length
string and substring
C get Substring from String
help with substring in c programing
remove a substring from a string
check if a substring exists in a string
SubString help - Java Beginners
C Programming SubString Program
Use of <fn:subString(String, int, int)> Tag of JSTL
JavaScript indexOf substring
Search string using substring
SubString in Java
String substring method example
JPA Substring() Function
String substring(int beginIndex)
find a substring by using I/O package
string and substring
String substring(int beginIndex, int endIndex)
write a java program for inserting a substring in to the given main string from a given position
Taking Substring
PHP SubString Function
Java SubString
String slice method example
Universal Label Decorations
String substr method example
String indexOf method example
Taking Substring
Logic Match Tag (<logic:match >...</logic:match >)
How to update a file
How to Make a Pdf and inserting data
how to call jsp variable through servlet
PHP get character from String
Java get Filename without Extension
How do I change a large string into hex and then into byte so that SHA1 can be applied to it?
how to code
how to update
how to display?
how to display?
how to display?
How to include?
How to connect

Ads