Delete number after slash in javascript [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Hey lets say I have url like this:
http://google.com/1/2
How do I delete last number(after last slash character)? all numbers can vary in length.

var URL = "http://google.com/1/2";
var newUrl = URL.substring(0, URL.lastIndexOf('/'));
console.log(newUrl);

Related

How to remove the array in a string? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
loginTime: "[2021-01-18 06:18:57.000000]";
I need this to -> "2021-01-18 06:18:57.000000";
how to remove the array and make it just string?
You could use something like this
"[2021-01-18 06:18:57.000000]".replace(/\[|\]/g, '')
Matches the character "[" and "]", replaces them with nothing.

Get parameters from URL with JS or jQuery [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I've this type of URL:
https://example.com/page#param1|param2
How can I get param1 and param2 ?
Thanks.
Those are part of the hash if you are getting them from the current url.
_hash = window.location.hash.split("|")
console.log(_hash)

Extracting specific string in a url using java code/javascript [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have the below url and I need to get back the value after api/ which is nam.
http://apidtgateway.mycompany.co.za:9800/agencychannel-uiapiservices/api/nam/CrmUserManagement/SaveActivity
Any help would be highly appriciated thanks in advance.
Here is how you will do it.
var URL = "http://apidtgateway.mycompany.co.za:9800/agencychannel-uiapiservices/api/nam/CrmUserManagement/SaveActivity";
if (URL.indexOf("api/") >= 0) {
var part = URL.split("api/")[1].split("/")[0];
console.log(part);
}

Regular expression start and end with word [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
The below code is full of string. I want to select cbUserURLs array variable.
var someurl =new Array('a','b');
var cbUserURLs =new Array('url1','url2',...);
.. //some code
What is the regular expression should I use here?
You just need use cbUserURLs.*\); if what you want is

how to summarize this string in javascript? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
i want summarize this line in javascript!
how is it possible?
var c='['+']'+'('+')'+';'+':'+'<'+'>'+
'='+'<='+'/='+'>='+'+'-'+'&'+'*'+'/'+'=>';
I searched for character escapes but i found nothing!
I think this is what you want:
var opr_re = /\[|\]|\(|\)|;|:|<|>|=|<=|\/=|>=|\+|-|&|\*|\/|=>/;
\ is the escape character in regular expressions.

Categories

Resources